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

Captain Freako capn.freako at gmail.com
Fri Oct 28 04:07:02 CEST 2011


Thanks for the reply, David.
I tried implementing your suggestions, such that my code now looks like this:

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

but I'm getting the same error as before:

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:15:10: `>>>' is not a (visible) method of class `Arrow'
Failed, modules loaded: none.

Any thoughts?

Thanks,
-db


On Thu, Oct 27, 2011 at 8:29 AM, David Barbour <dmbarbour at gmail.com> wrote:
>
> On Thu, Oct 27, 2011 at 5:55 AM, Captain Freako <capn.freako at gmail.com>
> wrote:
>>
>> SF.hs:11:10: `>>>' is not a (visible) method of class `Arrow'
>> Failed, modules loaded: none.
>
> import Prelude hiding ((.),id)
> import Control.Category
> you'll also need to define `instance Category SF`, since that is a
> requirement for Arrows.
>
>



More information about the Haskell-Cafe mailing list