Reputation: 467
I defined a typeclass Vector as
data Vector a = Vector a a a deriving (Show, Read)
But when I convert from strings using code
read "Vector 1 2 3" :: Vector
It does not work. Can anyone help. Thanks!
Upvotes: 0
Views: 47
Reputation: 116139
Vector
is not a type, but a type constructor. Vector Int
, Vector Double
, Vector (Vector String)
are types. Use
read "Vector 1 2 3" :: Vector <<some type here>>
Upvotes: 5