[Haskell-cafe] Trouble defining `instance Arrow SF'

Captain Freako capn.freako at gmail.com
Thu Oct 27 14:55:04 CEST 2011


In trying to follow along with `Programming with Arrows' by John
Hughes, I'm entering the following code:

  1 -- Taken from `Programming with Arrows'.
  2
  3 module SF where
  4
  5 import Control.Arrow
  6
  7 newtype SF a b = SF {runSF :: [a] -> [b]}
  8
  9 instance Arrow SF where
 10     arr f = SF (map f)
 11     SF f >>> SF g = SF (f >>> g)

and getting the following error from GHCI:


GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :load SF
[1 of 1] Compiling SF               ( SF.hs, interpreted )

SF.hs:11:10: `>>>' is not a (visible) method of class `Arrow'
Failed, modules loaded: none.

Can anyone help?

Thanks,
-db



More information about the Haskell-Cafe mailing list