... | ... | @@ -40,15 +40,14 @@ Foo.hs:7:10: |
|
|
```
|
|
|
|
|
|
|
|
|
then the easiest way to fix this error is by defining an `Applicative` (and possibly a `Functor`) instance:
|
|
|
then an easy way to fix this error is by defining an `Applicative` (and possibly a `Functor`) instance:
|
|
|
|
|
|
```
|
|
|
instanceFunctorFoowhere
|
|
|
fmap = liftM
|
|
|
|
|
|
instanceApplicativeFoowhere
|
|
|
pure = return
|
|
|
(<*>)= ap -- defined in Control.Monad
|
|
|
-- or alternatively:-- fmap = m >>= pure . finstanceApplicativeFoowhere
|
|
|
pure ={- move the definition of `return` from the `Monad` instance -}(<*>)= ap {- defined in Control.Monad -}-- or alternatively:-- f1 <*> f2 = f1 >>= \v1 -> f2 >>= (pure . v1)instanceMonadFoowhere
|
|
|
return = pure {- definition moved to `Applicative(pure)` -}{- ...retain other previous definitions... -}
|
|
|
```
|
|
|
|
|
|
|
... | ... | |