On 28/10/06, Jason Dagit <[EMAIL PROTECTED]> wrote:
So you specified that the types which T' wraps up should be instances
of Show, so to me it makes sense that you should be able to derive
Show in a way similar to how newtype deriving works. But perhaps
there is a subtlety that I'm missing?
No
On 10/27/06, David House <[EMAIL PROTECTED]> wrote:
On 27/10/06, David House <[EMAIL PROTECTED]> wrote:
> heteroList' = [MkT' 5, MkT' (), MkT' True]
> main = mapM_ print heteroList'
>
> {- prints:
> 5
> ()
> True
> -}
Sorry, the definition of main is a bit off. It should read:
main = mapM_ (\(M
On 27/10/06, David House <[EMAIL PROTECTED]> wrote:
heteroList' = [MkT' 5, MkT' (), MkT' True]
main = mapM_ print heteroList'
{- prints:
5
()
True
-}
Sorry, the definition of main is a bit off. It should read:
main = mapM_ (\(MkT' x) -> print x) heteroList'
Of course you have to unpack the M
On 27/10/06, Greg Buchholz <[EMAIL PROTECTED]> wrote:
I thought "exists" was spelled "forall" in Haskell?
There is some confusion here, I know it had me for a long time. forall
really does mean 'for all'. I think of types as sets of values with
that type, and forall as an intersection of th
Ben Rudiak-Gould wrote:
> The way to think about it is that foralls are extra function arguments.
> Your first example is like
>
> foo :: Integer -> (a::Type -> Show a -> a)
>
> so a is chosen by the caller, not by you. The second case is like
>
> bar :: Integer -> (a::Type -> Show a -> a -
"Greg Buchholz" <[EMAIL PROTECTED]> wrote:
> I'm not quite sure why this is illegal...
>
>> foo :: Integer -> (forall a. Show a => a)
>> foo 2 = ["foo"]
>> foo x = x
The type signature promises that foo returns a function that has type a
*for all a* (that are in Show). But neither a string list no
Greg Buchholz wrote:
I'm not quite sure why this is illegal...
foo :: Integer -> (forall a. Show a => a)
foo 2 = ["foo"]
foo x = x
...while this is just fine...
bar :: Integer -> (forall a. Show a => a->b) -> b
bar 2 k = k ["bar"]
bar x k = k x
The way to think about it is that foralls
Anyone know of a good source for learning about higher ranked types?
I'm not quite sure why this is illegal...
> foo :: Integer -> (forall a. Show a => a)
> foo 2 = ["foo"]
> foo x = x
...while this is just fine...
> bar :: Integer -> (forall a. Show a => a->b) -> b
> bar 2 k = k ["bar"]
> "John" == John Ky <[EMAIL PROTECTED]> writes:
John> Hi,I'm interested in using Parsec to parse utf-8 files and
John> do some processing and output a utf-8 document. Is there
John> anything I should be aware of? Does GHC handle all the
John> utf-8 stuff automatically? What does it mean whe
Hello,
I've written some code that does a foldl (or scanl, depending on my
mood) kind of thing, and builds a huge tree structure as it goes
along. I've been careful to make "insert"s as strict (and eager) as
possible, since I know all the pieces will be evaluated eventually
anyway. Now I'd like t
Hi,I'm interested in using Parsec to parse utf-8 files and do some processing and output a utf-8 document. Is there anything I should be aware of? Does GHC handle all the utf-8 stuff automatically? What does it mean when I find that parsec is picking up "" at the beginning of the file.
Thanks
11 matches
Mail list logo