[Haskell-cafe] Problem with prepose.lhs and ghc6.10.1
ekmett at gmail.com
Fri Apr 3 15:29:18 EDT 2009
With the changes to ScopedTypeVariables in GHC you can't pick up the type
from the return type of your function directly, so you'll need either a
combinator to do the work or to pass the type in question in as an argument
to a helper function.
normalize :: (Modular s a, Integral a) => a -> (M s a)
normalize = normalize' undefined where
normalize' :: (Modular s a, Integral a) => s -> a -> (M s a)
normalize' s a = M (a `mod` modulus s)
There is an implementation of the reflection code with minor modifications
to work with the modern version of GHC's ScopedTypeVariables in hackage
as 'reflection' and a minimalist implementation of modular arithmetic from
the same paper (if not yet including the residue number system based
optimizations) available in 'monoids' as Data.Ring.ModularArithmetic. Both
have only been fleshed out as far as I've needed them for other purposes,
but should be usable.
On Thu, Apr 2, 2009 at 11:59 AM, Henry Laxen <nadine.and.henry at pobox.com>wrote:
> Dear Group,
> I'm trying to read the paper:
> "Functional Pearl: Implicit Configurations"
> at http://www.cs.rutgers.edu/~ccshan/prepose/
> and when running the code in prepose.lhs I get:
> ../haskell/prepose.lhs:707:0: Parse error in pattern
> which is pointing at:
> normalize a :: M s a = M (mod a (modulus (undefined :: s)))
> The paper says it uses lexically scoped type variables. I tried reading
> them at:
> so I added -XScopedTypeVariables to my OPTIONS but I still get the same
> message. I would really like to play with the code in the paper, but I'm
> at this point. Any pointers would be appreciated.
> Best wishes,
> Henry Laxen
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe