[Haskell-cafe] Problem with prepose.lhs and ghc6.10.1

Edward Kmett 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.

-Edward Kmett

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
> about
> them at:
>
> http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extensions.html#scoped-type-variables
>
> so I added -XScopedTypeVariables to my OPTIONS but I still get the same
> error
> message.  I would really like to play with the code in the paper, but I'm
> stuck
> at this point.  Any pointers would be appreciated.
> Best wishes,
> Henry Laxen
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090403/043a8b50/attachment.htm


More information about the Haskell-Cafe mailing list