nominolo / atto-lisp

Efficient parsing and encoding of Lisp expressions for Haskell.
Other
24 stars 16 forks source link

build error (GHC 6.12.3) #4

Closed kowey closed 8 years ago

kowey commented 13 years ago

Hi Thomas,

One of my users reports the following build error with GHC 6.12.3. Do you think it's an easy fix? Thanks! :-)

Data/AttoLisp.hs:1:0:
    Couldn't match expected type `c' against inferred type `b'
      `c' is a rigid type variable bound by
          the instance declaration at Data/AttoLisp.hs:308:34
      `b' is a rigid type variable bound by
          the instance declaration at Data/AttoLisp.hs:308:32
    When using functional dependencies to combine
      ParseList b b,
        arising from a use of `parseList' at Data/AttoLisp.hs:312:4-25
      ParseList b c,
        arising from the instance declaration at Data/AttoLisp.hs:308:9-59

Data/AttoLisp.hs:309:2:
    Couldn't match expected type `c' against inferred type `b'
      `c' is a rigid type variable bound by
          the instance declaration at Data/AttoLisp.hs:308:34
      `b' is a rigid type variable bound by
          the instance declaration at Data/AttoLisp.hs:308:32
    When using functional dependencies to combine
      ParseList a a,
        arising from the dependency `a -> b'
        in the instance declaration at Data/AttoLisp.hs:314:9
      ParseList b c,
        arising from a use of `parseList' at Data/AttoLisp.hs:312:4-25
    When generalising the type(s) for `parseList'
    In the instance declaration for `ParseList (a -> b) c'

Data/AttoLisp.hs:312:4:
    Overlapping instances for ParseList b b
      arising from a use of `parseList' at Data/AttoLisp.hs:312:4-25
    Matching instances:
      instance ParseList a a -- Defined at Data/AttoLisp.hs:314:9-21
      instance (FromLisp a, ParseList b c) => ParseList (a -> b) c
        -- Defined at Data/AttoLisp.hs:308:9-59
    (The choice depends on the instantiation of `b'
     To pick the first instance above, use -XIncoherentInstances
     when compiling the other instance declarations)
    In the expression: parseList msg (f y) xs
    In the expression:
        do { y <- parseLisp x;
             parseList msg (f y) xs }
    In the definition of `parseList':
        parseList msg f (x : xs)
                    = do { y <- parseLisp x;
                           parseList msg (f y) xs }
cabal: Error: some packages failed to install:
atto-lisp-0.2 failed during the building phase. The exception was:
ExitFailure 1
kowey commented 13 years ago

What's also odd about this is that I could have sworn I was using GHC 6.12.x on a Windows VM to build atto-lisp too. So I don't know what it should fail for my user...

nominolo commented 13 years ago

I don't think so.

The problem is with the 'struct' function and its use of the ParseList type class.

The idea is to have the user provide a function (actually a constructor) and from that we can automatically figure out the parser. I'm not sure if this is even supposed to work, but it seems to work fine with GHC 7+. I'll take a look.

On 9 September 2011 11:51, kowey reply@reply.github.com wrote:

Hi Thomas,

One of my users reports the following build error with GHC 6.12.3.  Do you think it's an easy fix?  Thanks! :-)

   Data/AttoLisp.hs:1:0:        Couldn't match expected type c' against inferred typeb'          c' is a rigid type variable bound by              the instance declaration at Data/AttoLisp.hs:308:34          b' is a rigid type variable bound by              the instance declaration at Data/AttoLisp.hs:308:32        When using functional dependencies to combine          ParseList b b,            arising from a use of `parseList' at Data/AttoLisp.hs:312:4-25          ParseList b c,            arising from the instance declaration at Data/AttoLisp.hs:308:9-59

   Data/AttoLisp.hs:309:2:        Couldn't match expected type c' against inferred typeb'          c' is a rigid type variable bound by              the instance declaration at Data/AttoLisp.hs:308:34          b' is a rigid type variable bound by              the instance declaration at Data/AttoLisp.hs:308:32        When using functional dependencies to combine          ParseList a a,            arising from the dependency a -> b'            in the instance declaration at Data/AttoLisp.hs:314:9          ParseList b c,            arising from a use ofparseList' at Data/AttoLisp.hs:312:4-25        When generalising the type(s) for parseList'        In the instance declaration forParseList (a -> b) c'

   Data/AttoLisp.hs:312:4:        Overlapping instances for ParseList b b          arising from a use of parseList' at Data/AttoLisp.hs:312:4-25        Matching instances:          instance ParseList a a -- Defined at Data/AttoLisp.hs:314:9-21          instance (FromLisp a, ParseList b c) => ParseList (a -> b) c            -- Defined at Data/AttoLisp.hs:308:9-59        (The choice depends on the instantiation ofb'         To pick the first instance above, use -XIncoherentInstances         when compiling the other instance declarations)        In the expression: parseList msg (f y) xs        In the expression:            do { y <- parseLisp x;                 parseList msg (f y) xs }        In the definition of `parseList':            parseList msg f (x : xs)                        = do { y <- parseLisp x;                               parseList msg (f y) xs }    cabal: Error: some packages failed to install:    atto-lisp-0.2 failed during the building phase. The exception was:    ExitFailure 1

Reply to this email directly or view it on GitHub: https://github.com/nominolo/atto-lisp/issues/4

Push the envelope. Watch it bend.

kowey commented 13 years ago

OK, just to make sure there's no needless sense of urgency, my user just told me they upgraded to GHC 7, so problem solved for my purposes :-)

nominolo commented 13 years ago

OK. I still want to make sure that the current implementation doesn't just work by accident. I'll ask haskell-cafe and see if Oleg chimes in.

nominolo commented 8 years ago

Closing, because 6.12 is no longer supported.