2
votes

I'm trying to install an application Termite - Util but I get this error in with the line 14

newtype CE m a = CE {unCE :: m a} deriving (Monad)

The error says:

ContextError.hs:14:45: No instance for (Applicative (CE m)) arising from the 'deriving' clause of a data type declaration Possible fix: use a standalone 'deriving instance' declaration, so you can specify the instance context yourself When deriving the instance for (Monad (CE m))

I have alredy try with the solution proposed in CIS 194: Homework 7

adding this:

instance Applicative (CE m) where pure = return (<*>) = ap

but I get this error again

ContextError.hs:14:45: No instance for (Functor (CE m)) arising from the 'deriving' clause of a data type declaration Possible fix: use a standalone 'deriving instance' declaration, so you can specify the instance context yourself When deriving the instance for (Monad (CE m))

I really don't know how to proceed, I'm new with Haskell

Thanks in advance.

1
As far as I know, thats because the base has changed: now Monad requires the type to be Applicative.Willem Van Onsem
You probably want to use deriving (Functor, Applicative, Monad) together. It wasn't required a few years ago, but it is now.chi
Thanks.. It's working with deriving (Functor, Applicative, Monad)Agustin Larreinegabe

1 Answers

1
votes

In ghc 7.10.1 AMP proposal took place. Prior to that you could define Monad instance without having Applicative instance, after 7.10.1 you have to define Functor and Applicative if you want to define a Monad.

https://wiki.haskell.org/Functor-Applicative-Monad_Proposal