i come across a problem with haskell about recursive Functor instance.
data List x = Hol | Hoofd x (List x)
deriving (Show,Eq,Ord)
instance Functor List where
fmap f (Hoofd x (Hoofd x)) = Hoofd (f x) Hoofd(f x)
fmap f Hol = Hol
fmap f Hoofd x (Hol) = Hoofd (f x)
I made a datatype List in which i need to inplement the Functor Fmap instance, i tried to use in the datatype deriving (Functor) but i gives me back an error with: can't derive Functor must use DeriveFunctor which i also did not understand...
please help
Functor
instance for the regular list? Your type is isomorphic to it, sofmap
is really justmap
adapted to your constructor names. – chepner