confusing type error

2014-12-04 Thread Evan Laforge
I recently got a confusing error msg, and reduced it to a small case: f1 :: Monad m = m Bool f1 = f2 0 0 'a' f2 :: Monad m = Int - Float - m Bool f2 = undefined From this, it's clear that f2 is being given an extra Char argument it didn't ask for. However, the error msg (ghc 7.8.3) is:

Re: confusing type error

2014-12-04 Thread Richard Eisenberg
This seems straightforwardly to be a bug, to me. HEAD gives the same behavior you report below. Please post on the bug tracker at https://ghc.haskell.org/trac/ghc/newticket Thanks! Richard On Dec 4, 2014, at 1:50 PM, Evan Laforge qdun...@gmail.com wrote: I recently got a confusing error msg,

Re: confusing type error

2014-12-04 Thread Brent Yorgey
Int - Float - Char - Bool *is* in fact a valid type for f2, since ((-) Char) is a Monad. However, I agree the error message is confusing, especially the expected n, but got n part. -Brent On Thu, Dec 4, 2014 at 1:50 PM, Evan Laforge qdun...@gmail.com wrote: I recently got a confusing error

Re: confusing type error

2014-12-04 Thread migmit
I don't see a bug here. f2 is perfectly OK, so, let's examine f1 more closely. It tries to get `m Bool` by applying f1 to three arguments: 0, 0, and 'a'. Now, since `f2` has the type `Int - Float - n Bool`, where `n` is of kind `* - *` (and an instance of `Monad` class, but it's not yet the

Re: confusing type error

2014-12-04 Thread Yuras Shumovich
It seems to be an instance of https://ghc.haskell.org/trac/ghc/ticket/7869 But it is fixed (both in HEAD and 7.8). Probably the fix is partial? On Thu, 2014-12-04 at 14:53 -0500, Richard Eisenberg wrote: This seems straightforwardly to be a bug, to me. HEAD gives the same behavior you report

Re: confusing type error

2014-12-04 Thread Evan Laforge
On Thu, Dec 4, 2014 at 12:59 PM, migmit mig...@gmail.com wrote: It tries to get `m Bool` by applying f1 to three arguments: 0, 0, and 'a'. Now, since `f2` has the type `Int - Float - n Bool`, where `n` is of kind `* - *` (and an instance of `Monad` class, but it's not yet the time to look

Re: Proving properties of type-level natural numbers obtained from user input

2014-12-04 Thread Alexander V Vershilov
Hi, Richard Can you give some ideas or where to read how to properly use signletons and unary naturals in order to be able to express such constraints? Thanks -- Alexander On 30 November 2014 at 23:26, Richard Eisenberg e...@cis.upenn.edu wrote: Hi Alexander, Nice idea to test against the