Send Beginners mailing list submissions to
        beginners@haskell.org

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
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

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 <e...@ertes.de>
Subject: Re: [Haskell-beginners] User-defined polymorphic data type:
        heterogeneous list?
To: beginners@haskell.org
Message-ID: <20110713003210.5b6d3...@angst.streitmacht.eu>
Content-Type: text/plain; charset=US-ASCII

David McBride <dmcbr...@neondsl.com> 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 <hask...@phirho.com>
Subject: Re: [Haskell-beginners] safetail problem
To: beginners@haskell.org
Message-ID: <4e1ccbd5.20...@phirho.com>
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 <e...@ertes.de>
Subject: Re: [Haskell-beginners] User-defined polymorphic data type:
        heterogeneous list?
To: beginners@haskell.org
Message-ID: <20110713003902.6cb97...@angst.streitmacht.eu>
Content-Type: text/plain; charset=US-ASCII

Arlen Cuss <cel...@sairyx.org> 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 <rwob...@hotmail.com>
Subject: Re: [Haskell-beginners] safetail problem
To: <beginners@haskell.org>
Message-ID: <snt118-w24ba3edc552834fbeee15fae...@phx.gbl>
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: hask...@phirho.com
> To: beginners@haskell.org
> 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
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners                             
>           


------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 37, Issue 23
*****************************************

Reply via email to