Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: User-defined polymorphic data type: heterogeneous list?
(Ertugrul Soeylemez)
2. Re: safetail problem (Thomas)
3. Re: User-defined polymorphic data type: heterogeneous list?
(Ertugrul Soeylemez)
4. Re: safetail problem (Roelof Wobben)
----------------------------------------------------------------------
Message: 1
Date: Wed, 13 Jul 2011 00:32:10 +0200
From: Ertugrul Soeylemez <[email protected]>
Subject: Re: [Haskell-beginners] User-defined polymorphic data type:
heterogeneous list?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII
David McBride <[email protected]> wrote:
> myList :: MyClass a => [a]
> myList = [somefunction True, somefunction False]
This is not a heterogenous list. The list elements would still have to
have the same type.
Greets,
Ertugrul
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
------------------------------
Message: 2
Date: Wed, 13 Jul 2011 00:33:57 +0200
From: Thomas <[email protected]>
Subject: Re: [Haskell-beginners] safetail problem
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 12.07.2011 22:45, Roelof Wobben wrote:
> Hello,
> I use Programming in Haskell from Graham Hutton.
> But I can't find anything in the first 4 chapters from that book why I must
> use (0,x) en what that means.
FWIW: chapter 4.4, page 33.
Regards,
Thomas
------------------------------
Message: 3
Date: Wed, 13 Jul 2011 00:39:02 +0200
From: Ertugrul Soeylemez <[email protected]>
Subject: Re: [Haskell-beginners] User-defined polymorphic data type:
heterogeneous list?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII
Arlen Cuss <[email protected]> wrote:
> As Mats pointed out, an existential quantification will let you define
> your polymorphic element (and to quote Mats):
>
> > {-# LANGUAGE ExistentialQuantification #-}
> >
> > data HeteroElement = forall a. Element a
> >
> > list = [Element 1, Element 'a', Element True]
>
> The question is, what can you do with this list? You can't "show" it,
> because there's no requirement on HeteroElement's "a" type of it
> having a Show instance (adding 'deriving Show' to the data statement
> will cause an error, as it cannot be done for all 'a'!). You can't
> find out their types. Indeed, you can't do anything at all with an
> Element, simply because there's no restriction placed on their
> value. They could contain anything at all.
This definition is indeed not very useful, but you can have something
like the following:
class Renderable a
class Updatable a
data GameObj = forall a. (Renderable a, Updatable a) => GameObj a
list :: [GameObj]
list = [ GameObj SpaceMarine,
GameObj Zombie,
GameObj BFG9000 ]
Greets,
Ertugrul
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/
------------------------------
Message: 4
Date: Wed, 13 Jul 2011 07:07:11 +0000
From: Roelof Wobben <[email protected]>
Subject: Re: [Haskell-beginners] safetail problem
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Oke,
I changed it to this : http://codepad.org/ROV4ASAB
But still there are errors.
Roelof
----------------------------------------
> Date: Wed, 13 Jul 2011 00:33:57 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: [Haskell-beginners] safetail problem
>
> On 12.07.2011 22:45, Roelof Wobben wrote:
> > Hello,
> > I use Programming in Haskell from Graham Hutton.
> > But I can't find anything in the first 4 chapters from that book why I must
> > use (0,x) en what that means.
>
> FWIW: chapter 4.4, page 33.
>
> Regards,
> Thomas
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 37, Issue 23
*****************************************