Ticket #5087 (closed bug: duplicate)

Opened 2 years ago

Last modified 2 years ago

No instance for (Functor ((->) b0)) arising from a use of `<$>'

Reported by: pSub Owned by:
Priority: normal Milestone:
Component: GHCi Version: 7.0.2
Keywords: Cc:
Operating System: Linux Architecture: x86
Type of failure: GHC rejects valid program Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I'm pretty new to Haskell so sorry if there is already a bug report for this or if it isn't a bug of ghc at all (e.g. some packaging problem).

I read learnyouahaskell.com and want to play with the Applicative Instance of (->) r. But when I enter

import Control.Applicative (+) <$> (+3) <*> (*100) $ 5

in ghci I get the following error: <interactive>:1:5:

No instance for (Functor ((->) b0))

arising from a use of `<$>'

Possible fix: add an instance declaration for (Functor ((->) b0)) In the first argument of (<*>)', namely (+) <$> (+ 3)' In the expression: (+) <$> (+ 3) <*> (* 100) In the expression: (+) <$> (+ 3) <*> (* 100) $ 5

This Problem does not occur when executing this small testprogramm with "ghc --make" or "runhaskell":

import Control.Applicative main = print $ (+) <$> (+3) <*> (*100) $ 5

So it seems ghci releated. I downgraded to 6.12.3 where the problem doesn't occur. I'm using Archlinux.

Change History

Changed 2 years ago by batterseapower

  • status changed from new to closed
  • resolution set to duplicate

Duplicate of #4832, which is now fixed. Use :m Control.Applicative instead as a workaround.

Note: See TracTickets for help on using tickets.