[Haskell-beginners] Help with type declaration using MArray

Perry James perry.james at computer.org
Mon Apr 18 04:38:17 CEST 2011


Hi all,

I'm working through Brown & Cook's "Monadic Memoization Mixins" and have
come across some code that I can't get to compile with GHC.

The error I get for

arrayDict :: (*MArray *arr (*Maybe *b) m, *Ix *a, *Ord *a)
          => a -> arr a (*Maybe *b) -> *Dict *a b m

is
    Non type-variable argument
      in the constraint: MArray arr (Maybe b) m
    (Use -XFlexibleContexts to permit this)
    In the type signature for `arrayDict':
      arrayDict :: (MArray arr (Maybe b) m, Ix a, Ord a) =>
                   a -> arr a (Maybe b) -> Dict a b m

Enabling FlexibleContexts causes other errors.  What could be going wrong?
In case this isn't enough context, I've posted the full source code for this
section of the paper at
smipple<http://www.smipple.net/snippet/Perry%20James/Monadic%20Memoization%20Mixins>
.

Thanks in advance for any help,
Perry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110417/13da08f6/attachment.htm>


More information about the Beginners mailing list