Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not in scope: <*>

Tags:

haskell

ghc

ghci

I was trying out some of the examples in the A Fistful of Monads chapter of Learn you a 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 <$>.

like image 685
Lorin Hochstein Avatar asked May 04 '14 00:05

Lorin Hochstein


1 Answers

These operators 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 of GHC 7.10, with the Functor-Applicative-Monad Proposal implemented in base 4.8, <*> is now present in the Prelude and does not require an import.

like image 94
Jon Purdy Avatar answered Sep 29 '22 18:09

Jon Purdy