Re: [Haskell-cafe] A voyage of undiscovery

2009-07-18 Thread wren ng thornton
Andrew Coppin wrote: That seems simple enough (although problematic to implement). However, the Report seems to say that it matters whether or not the bindings are muturally recursive [but I'm not sure precisely *how* it matters...] Seriously, check out the classic Milner paper. Of

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-18 Thread wren ng thornton
Andrew Coppin wrote: Robert Greayer wrote: f0 _ = (foo True, foo 'x') where foo = id is well-typed. Really? That actually works? How interesting... This suggests to me that where-clauses also do strange things to the type system. Not too strange, in fact we need it to do that for

[Haskell-cafe] A voyage of undiscovery

2009-07-17 Thread Bernie Pope
2009/7/17 Andrew Coppin andrewcop...@btinternet.com: I've been working hard this week, and I'm stumbled upon something which is probably of absolutely no surprise to anybody but me. Consider the following expression:  (foo True, foo 'x') Is this expression well-typed? Astonishingly, the

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-17 Thread Andrew Coppin
Derek Elkins wrote: The answer to your questions are on the back of this T-shirt. http://www.cafepress.com/skicalc.6225368 Oh... dear God. o_O ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-17 Thread Andrew Coppin
John Meacham wrote: actually, the rules are pretty straightforward. It doesn't matter where something is bound, just _how_ it is bound. Let-bound names (which includes 'where' and top-level definitions) can be polymorphic. lambda-bound or case-bound names (names bound as an argument to a

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-17 Thread Stefan Holdermans
Andrew, That seems simple enough (although problematic to implement). However, the Report seems to say that it matters whether or not the bindings are muturally recursive [but I'm not sure precisely *how* it matters...] It means that functions can only be used monomorphically within

[Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Andrew Coppin
I've been working hard this week, and I'm stumbled upon something which is probably of absolutely no surprise to anybody but me. Consider the following expression: (foo True, foo 'x') Is this expression well-typed? Astonishingly, the answer depends on where foo is defined. If foo is a

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Miguel Mitrofanov
Consider the following expression: (foo True, foo 'x') Is this expression well-typed? Astonishingly, the answer depends on where foo is defined. If foo is a local variable, then the above expression is guaranteed to be ill-typed. However, if we have (for example) That's not true: main =

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Robert Greayer
On Thu, Jul 16, 2009 at 2:34 PM, Andrew Coppinandrewcop...@btinternet.com wrote: I've been working hard this week, and I'm stumbled upon something which is probably of absolutely no surprise to anybody but me. Consider the following expression:  (foo True, foo 'x') Is this expression

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Andrew Coppin
Robert Greayer wrote: f0 _ = (foo True, foo 'x') where foo = id is well-typed. Really? That actually works? How interesting... This suggests to me that where-clauses also do strange things to the type system. whereas f1 foo = (foo True, foo 'x') requires 'foo' to be polymorphic in

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Ross Mellgren
It's not where -- let also works let { foo Prelude let { foo x = x } in (foo 1, foo True) (1,True) Can you send the code you're trying that doesn't work? -Ross On Jul 16, 2009, at 3:40 PM, Andrew Coppin wrote: Robert Greayer wrote: f0 _ = (foo True, foo 'x') where foo = id is well-typed.

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Jason Dagit
On Thu, Jul 16, 2009 at 12:40 PM, Andrew Coppin andrewcop...@btinternet.com wrote: Robert Greayer wrote: f0 _ = (foo True, foo 'x') where foo = id is well-typed. Really? That actually works? How interesting... This suggests to me that where-clauses also do strange things to the type

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Andrew Coppin
Ross Mellgren wrote: It's not where -- let also works Prelude let { foo x = x } in (foo 1, foo True) (1,True) Awesome. So by attempting to implement Haskell's type system, I have discovered that I actually don't understand Haskell's type system. Who'd have thought it? Clearly I must go

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Andrew Coppin
Andrew Coppin wrote: Awesome. So by attempting to implement Haskell's type system, I have discovered that I actually don't understand Haskell's type system. Who'd have thought it? Clearly I must go consult the Report and check precisely what the rules are... I just read section 4.5 of the

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Derek Elkins
On Thu, Jul 16, 2009 at 2:52 PM, Andrew Coppinandrewcop...@btinternet.com wrote: Ross Mellgren wrote: It's not where -- let also works Prelude let { foo x = x } in (foo 1, foo True) (1,True) Awesome. So by attempting to implement Haskell's type system, I have discovered that I actually

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread Ross Mellgren
Is everything an acceptable answer? -Ross On Jul 16, 2009, at 6:38 PM, Derek Elkins wrote: On Thu, Jul 16, 2009 at 2:52 PM, Andrew Coppinandrewcop...@btinternet.com wrote: Ross Mellgren wrote: It's not where -- let also works Prelude let { foo x = x } in (foo 1, foo True) (1,True)

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-16 Thread John Meacham
On Thu, Jul 16, 2009 at 08:52:40PM +0100, Andrew Coppin wrote: Ross Mellgren wrote: It's not where -- let also works Prelude let { foo x = x } in (foo 1, foo True) (1,True) Awesome. So by attempting to implement Haskell's type system, I have discovered that I actually don't understand