Not in scope: <*>

I studied some examples from the chapter A Fistful of Monads , in which you learned about Haskell, and some returned errors when I ran them in GHCi 7.6. 3:

 Prelude> Just (+3) <*> Just 3 <interactive>:2:11: Not in scope: `<*>' 

I get a similar error when using <$> .

+7
source share
1 answer

These statements are from Control.Applicative . You need to import Control.Applicative or say :m +Control.Applicative in ghci . You can find out where many standard operators come from using Hoogle .

As in GHC 7.10, with the Offer-Applicative-Monad implemented in base 4.8 , <*> now present in the prelude and does not require import.

+17
source

All Articles