Quote from PHB pg. 250 in reference to the spell "Haste"
"...gains an additional action on each of its turns. That action can be used only to take the Attack (one weapon attack only), Dash, Disengage, Hide, or Use an Object actions..."
Quote from PHB pg. 192 in reference to Actions in Combat: Attack
"With this action, you make one melee or ranged attack."
So, while some spells are, quite literally, attacks, they do not fall under the "Attack" classification in regards to Actions in Combat, despite having to do an attack roll. There is a separate excerpt under Actions in Combat (PHB pg. 192) that references spellcasting, Cast a Spell; under which, spells are not technically even considered actions because of the fact "each spell has it's own casting time which specifies whether the caster must use an action, reaction, minutes or even hours..."
Actions in Combat clearly states what can be done during combat:
-Attack (melee or ranged, but not magic)
-Cast a spell
-Dash
-Disengage
-Dodge
-Help
-Hide
-Ready
-Search
-Use an Object
Haste clearly states that the action it allows the target can only be used for:
-Attack (melee or ranged; one weapon attack only, so no extra attack or weapon surges)
-Dash
-Disengage
-Hide
-Use an Object
"Cast a Spell" from the Actions in Combat section of PHB Pg.192, is clearly missing from that list of actions allowed by Haste