[Haskell-cafe] GHCi's :t misbehaving

Simon Peyton-Jones simonpj at microsoft.com
Wed Nov 18 09:38:12 EST 2009


Are you wanting the type of a variable?  You probably want :i

What is the actual type of the variable?  Or is it an expression?

Without more info it's hard to help.  You should be able to make a repo case without all the supporting code by defining

thing1 :: <type 1>
thing1 = error "urk"

and so on for other variables.  Then :t <expression>

Simon

S

| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-bounces at haskell.org] On
| Behalf Of Philippa Cowderoy
| Sent: 18 November 2009 01:31
| To: Haskell cafe
| Subject: [Haskell-cafe] GHCi's :t misbehaving
| 
| I have some mildly complicated parsing code, that uses parsec to return
| a computation (in a state monad) that handles operator precedence - so I
| can handle scoped precedence/fixities, much like in Haskell. I just
| spent a while bolting on some new features. More time than I'd like, I'd
| left it alone for a while and it took a bit of time getting my head
| around it again enough to be okay doing folds on parse results and the
| like. Enough so that I've been leaning on the type checker to tell me
| when I've messed up!
| 
| So, I have something that loads into ghci okay now. I go to check the
| type of one of the functions using :t and get this error:
| <interactive>:1:0:
|     Ambiguous type variable `m' in the constraint:
|       `Monad m'
|         arising from a use of `constructor' at <interactive>:1:0-10
|     Probable fix: add a type signature that fixes these type variable(s)
| 
| Now I'm not about the supply the type signature, that's what I asked it
| for! And it ought to typecheck okay, given that the code loaded in the
| first place. I'm about to turn in for the night, but I'm wondering
| what's going on here. Anyone?
| 
| --
| flippa at flippac.org
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list