Quantcast

Parsec type error with Flexible Contexts

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Parsec type error with Flexible Contexts

Marco Túlio Pimenta Gontijo
Hi.

I wanted to generalize the definitions in Text.Parsec.Language to be
able to use them with Parsec Text instead of Parsec String.  I'm
getting a type error with the following code snippet:
http://hpaste.org/72844

I don't really understand the error, specially with regard to the fact
that the if I comment one of the marked lines on the code pasted the
program build.

Any help is welcome.

Greetings.

--
marcot
http://marcot.eti.br/

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Parsec type error with Flexible Contexts

Felipe Lessa
Hello!

I've managed to reduce your code to a much simpler test case (without
parsec) but I'm still not sure why this is happening:


{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts #-}

data D m
  = D { bar1 :: P m ()
      , bar2 :: P m ()
      }

data P m c = P

class S m c where

foo :: S m () => P m ()
foo = undefined

emptyDef :: S m () => D m
emptyDef
  = D
    { bar1 = foo
    , bar2 = foo
    }

haskellStyle :: S m () => D m
haskellStyle
  = emptyDef
    { bar1 = foo
    , bar2 = foo
    }


Cheers,

--
Felipe.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Parsec type error with Flexible Contexts

Felipe Lessa
Here's an even smaller one:


{-# LANGUAGE MultiParamTypeClasses, FlexibleContexts #-}

data D m = D { bar :: P m () }
data P m c = P
class S m c where

foo :: S m () => P m ()
foo = undefined

emptyDef :: S m () => D m
emptyDef = D foo

haskellStyle :: S m () => D m
haskellStyle = emptyDef { bar = foo }


Cheers,

--
Felipe.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Loading...