Re: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-09 Thread Andrew Coppin
Ryan Ingram wrote: There's also a haskell98 way to do the same thing, it's just a bit more wordy at the ghci prompt, and a bit more work to decode the result: ghci> :t \z -> (foo (undefined :: Bar x) z :: Bar y) Now, the type of this expression is clearly type of z -> Bar y So just read the

Re: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-09 Thread Andrew Coppin
Reiner Pope wrote: The syntax is for the implicit parameter extension[1]. I think you would write your example as foo (undefined :: Bar x) ?z :: Bar y Then querying the type of that whole expression with :t will list ?z's type in the expression's constraints. (Of course, you should turn off

Re: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-09 Thread Ryan Ingram
2008/10/9 Reiner Pope <[EMAIL PROTECTED]>: > The syntax is for the implicit parameter extension[1]. I think you would > write your example as > > foo (undefined :: Bar x) ?z :: Bar y > > Then querying the type of that whole expression with :t will list ?z's type > in the expression's constraints. (

Re: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-08 Thread Reiner Pope
The syntax is for the implicit parameter extension[1]. I think you would write your example as foo (undefined :: Bar x) ?z :: Bar y Then querying the type of that whole expression with :t will list ?z's type in the expression's constraints. (Of course, you should turn off the monomorphism restric

Re: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-08 Thread Andrew Coppin
Ryan Ingram wrote: There is such a tool, it's called ghci :) It just takes a bit of massaging to do what you want: ghci> :set -fglasgow-exts ghci> :t (?f some_func [?a .. ?b]) Here's an example: Prelude> :t ?f map [?a .. ?b] ?f map [?a .. ?b] :: forall t a b t1. (Enum t1,

Re: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-08 Thread Ryan Ingram
On Tue, Oct 7, 2008 at 7:09 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote: > For my current troubles, it would be really useful if there were some > program that you could feed some source code to, and it would tell you what > the inferred types of each subexpression are. (Ideally it would be nice if

Re: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-07 Thread Andrew Coppin
Mitchell, Neil wrote: Well, as I said, replacing one term with another transforms one signature into the other. I guess you can't curry type constructors as easily as functions - or at least, Hoogle currently doesn't like it. Yes, currying of type constructors is much less common, and en

RE: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-07 Thread Mitchell, Neil
> Actually, I was thinking more along the lines of > Data.Traversable.sequence, which has > > sequence :: (Traversable t, Monad m) => t (m a) -> m (t a) > > > Are you expecting c1 (:: * -> * -> *) to unify with [] (:: * -> *)? > > That seems kind incorrect at the very last. Additionally, > t

Re: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-06 Thread Andrew Coppin
Mitchell, Neil wrote: Hi Try doing a Hoogle search for "c1 (c2 x) -> c2 (c1 x)". Hoogle correctly states that Data.Traversable.sequence will do it for you. Now try doing "c1 k (c2 x) -> c2 (c1 k x)". The 'sequence' function will also do this, but now Hoogle returns 0 results. This is p

RE: [Haskell-cafe] Hoogle? [Stacking monads]

2008-10-06 Thread Mitchell, Neil
Hi > Try doing a Hoogle search for "c1 (c2 x) -> c2 (c1 x)". > Hoogle correctly states that Data.Traversable.sequence will > do it for you. > > Now try doing "c1 k (c2 x) -> c2 (c1 k x)". The 'sequence' > function will also do this, but now Hoogle returns 0 results. > > This is puzzling, sinc

[Haskell-cafe] Hoogle? [Stacking monads]

2008-10-03 Thread Andrew Coppin
Andrew Coppin wrote: After much searching (Hoogle rather failed me here), I discover that... I could probably elaborate on that point further. Try doing a Hoogle search for "c1 (c2 x) -> c2 (c1 x)". Hoogle correctly states that Data.Traversable.sequence will do it for you. Now try doing "c1