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
        [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:  Exercises for beginners and Natural Tansformations
      (Federico Brubacher)
   2.  data declarations (Roger Myers)
   3. Re:  data declarations (Brandon S. Allbery KF8NH)
   4. Re:  data declarations (Jeff Zaroyko)
   5. Re:  data declarations (Bas van Dijk)
   6. Re:  Re: New List (Benjamin L.Russell)
   7. Re:  Re: New List (Vitor Cortines)
   8.  Morphing Endo (ICFP Contest 2007)
      (Rafael Gustavo da Cunha Pereira Pinto)


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

Message: 1
Date: Tue, 22 Jul 2008 08:48:38 -0300
From: "Federico Brubacher" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] Exercises for beginners and Natural
        Tansformations
To: "Benjamin L. Russell" <[EMAIL PROTECTED]>
Cc: beginners@haskell.org
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

>
> >[1] http://blog.tmorris.net/haskell-exercises-for-beginners/
>
> It seems that you forgot to include the link to [2].  Which reference
> was that?
>
> -- Benjamin L. Russell


Yes, sorry about that, [2] was :
[2]
http://www.haskell.org/haskellwiki/Category_theory/Natural_transformation

Thank you guys!!

Federico

-- 
Federico Brubacher
www.fbrubacher.com

Colonial Duty Free Shop
www.colonial.com.uy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20080722/9e9f1f6b/attachment-0001.htm

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

Message: 2
Date: Wed, 23 Jul 2008 03:01:23 +0000 (UTC)
From: Roger Myers <[EMAIL PROTECTED]>
Subject: [Haskell-begin] data declarations
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

hi

Not sure if I'm on the right track here, so as a beginner I thought I'd ask on 
this list.

I want to declare a type 'All' that consists of the of the types 'Tinteger, 
Tbool, Tstring, Tarray' but I would also like to make a relationship that 
Tinteger and Tbool are also the type 'Simple' and that 'Tstring' and 'Tarray' 
are 'Composite' and that Mixed is then either Simpletype or Composite.

So I can then write a function that takes a type of All and produces a list of 
Mixed.

data All = Tinteger Int
              | Tbool Bool
              | Tstring String
              | Tarray [Alltypes]

data Simple = Tinteger
            | Tbool
data Composite = Tstring
               | Tarray

data Mixed = Simple
           | Composite

k :: All -> [Mixed]
k a = case a of
        Simple s -> [Simple s]
        Composite c -> [Composite c]


But this isn't valid Haskell code because I can't have multiple declarations of 
the same types, is there a way to specify a relationship, if so can someone 
point me in the right direction?

Roger



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

Message: 3
Date: Tue, 22 Jul 2008 23:26:22 -0400
From: "Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] data declarations
To: Roger Myers <[EMAIL PROTECTED]>, beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On 2008 Jul 22, at 23:01, Roger Myers wrote:

> Not sure if I'm on the right track here, so as a beginner I thought  
> I'd ask on
> this list.
>
> I want to declare a type 'All' that consists of the of the types  
> 'Tinteger,
> Tbool, Tstring, Tarray' but I would also like to make a relationship  
> that
> Tinteger and Tbool are also the type 'Simple' and that 'Tstring' and  
> 'Tarray'
> are 'Composite' and that Mixed is then either Simpletype or Composite.
>
> So I can then write a function that takes a type of All and produces  
> a list of
> Mixed.


Any particular reason that All can't be represented by Mixed?  That  
would be my first cut at it (assuming I didn't need advanced type  
hackery for some reason).

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH




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

Message: 4
Date: Wed, 23 Jul 2008 03:42:32 +0000 (UTC)
From: Jeff Zaroyko <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] data declarations
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

Brandon S. Allbery KF8NH <allbery <at> ece.cmu.edu> writes:

> 
> 
> On 2008 Jul 22, at 23:01, Roger Myers wrote:
> 
> > Not sure if I'm on the right track here, so as a beginner I thought  
> > I'd ask on
> > this list.
> >
> > I want to declare a type 'All' that consists of the of the types  
> > 'Tinteger,
> > Tbool, Tstring, Tarray' but I would also like to make a relationship  
> > that
> > Tinteger and Tbool are also the type 'Simple' and that 'Tstring' and  
> > 'Tarray'
> > are 'Composite' and that Mixed is then either Simpletype or Composite.
> >
> > So I can then write a function that takes a type of All and produces  
> > a list of
> > Mixed.
> 
> Any particular reason that All can't be represented by Mixed?  That  
> would be my first cut at it (assuming I didn't need advanced type  
> hackery for some reason).
> 

Hmm... ah, bad thinking on my part.  I think this serves me a lot better:


data Simple = Tinteger Int
            | Tbool Bool
data Composite = Tstring String
               | Tarray [All]

data All = Simple | Composite

k :: All -> [All]
k a = case a of
        Simple -> [a]
        Composite -> [a]


Thanks :)



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

Message: 5
Date: Wed, 23 Jul 2008 09:15:16 +0200
From: "Bas van Dijk" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] data declarations
To: "Jeff Zaroyko" <[EMAIL PROTECTED]>
Cc: beginners@haskell.org
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Jul 23, 2008 at 5:42 AM, Jeff Zaroyko <[EMAIL PROTECTED]> wrote:
> data Simple = Tinteger Int
>            | Tbool Bool
> data Composite = Tstring String
>               | Tarray [All]
>
> data All = Simple | Composite

Don't you mean:

data All = Simple Simple | Composite Composite

So the 'All' type contains the 'Simple' and 'Composite' types. In case
you find it confusing that the constructor names are the same as the
names of the types you can write something like:

data All = S Simple | C Composite

I don't know what your 'k' should do. Because your function...

> k :: All -> [All]
> k a = case a of
>        Simple -> [a]
>        Composite -> [a]

...can be simplified to: 'k a = [a]'  (if you disregard the strictness
properties)

which isn't very useful. So I guess you mean something different.

regards,

Bas


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

Message: 6
Date: Wed, 23 Jul 2008 18:49:43 +0900
From: Benjamin L.Russell <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] Re: New List
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

On Tue, 22 Jul 2008 13:49:19 +0300, "Angelos Sphyris"
<[EMAIL PROTECTED]> wrote:

>I believe that using beginners@haskell.org and [Haskell-begin] in the subject 
>line may confuse people. 
>So, I would opt for [Haskell-beginners]. 

Thank you for your response.

While I agree for this exact reason, since some users had voiced the
view that "[Haskell-beginners]" seemed too long, I would rather wait
for a few days to see the overall response to the argument (it is
possible that some readers may have been too busy to check this thread
lately).

If "[Haskell-beginners]" seems acceptable as a prefix for the subject
line to readers of this mailing list, let's try it out to see if it
works (we can always change it back).  Otherwise, we'll just continue
using "[Haskell-begin]."

I would suggest at least trying out "[Haskell-beginners]" on a few
threads for a few days to see if it can work.  Otherwise, we will
never know.  If readers then start complaining "I can't stand the new
prefix, because now I can't read the subject line well in my narrow
mail tool/newsreader window," then I'll change it back right away.
Then we'll know for sure.  Some users may actually prefer the new
prefix.

I'll wait for about three days to see the response to this argument on
this thread before actually changing anything, unless readers say that
trying out the new prefix is not acceptable.

-- Benjamin L. Russell



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

Message: 7
Date: Wed, 23 Jul 2008 07:47:59 -0300
From: "Vitor Cortines" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] Re: New List
To: "Benjamin L. Russell" <[EMAIL PROTECTED]>
Cc: beginners@haskell.org
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

I'm all for at least trying out [Haskell-beginners].
I believe it's easier to understand on first look, even for non native
English speakers.
Let's give it a shot!

On Wed, Jul 23, 2008 at 6:49 AM, Benjamin L. Russell <[EMAIL PROTECTED]>
wrote:

> On Tue, 22 Jul 2008 13:49:19 +0300, "Angelos Sphyris"
> <[EMAIL PROTECTED]> wrote:
>
> >I believe that using beginners@haskell.org and [Haskell-begin] in the
> subject line may confuse people.
> >So, I would opt for [Haskell-beginners].
>
> Thank you for your response.
>
> While I agree for this exact reason, since some users had voiced the
> view that "[Haskell-beginners]" seemed too long, I would rather wait
> for a few days to see the overall response to the argument (it is
> possible that some readers may have been too busy to check this thread
> lately).
>
> If "[Haskell-beginners]" seems acceptable as a prefix for the subject
> line to readers of this mailing list, let's try it out to see if it
> works (we can always change it back).  Otherwise, we'll just continue
> using "[Haskell-begin]."
>
> I would suggest at least trying out "[Haskell-beginners]" on a few
> threads for a few days to see if it can work.  Otherwise, we will
> never know.  If readers then start complaining "I can't stand the new
> prefix, because now I can't read the subject line well in my narrow
> mail tool/newsreader window," then I'll change it back right away.
> Then we'll know for sure.  Some users may actually prefer the new
> prefix.
>
> I'll wait for about three days to see the response to this argument on
> this thread before actually changing anything, unless readers say that
> trying out the new prefix is not acceptable.
>
> -- Benjamin L. Russell
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
Vitor J. Cortines
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20080723/1c655708/attachment-0001.htm

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

Message: 8
Date: Wed, 23 Jul 2008 22:11:10 -0300
From: "Rafael Gustavo da Cunha Pereira Pinto" <[EMAIL PROTECTED]>
Subject: [Haskell-begin] Morphing Endo (ICFP Contest 2007)
To: beginners@haskell.org
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

        Did any of you tried to do a Haskell implementation of the ICFPC
2007 problem?

        I was thinking of using it as a learning exercise, but I am afraid
of the stack. My approach is:

1) use Data.ByteString.Lazy.Char8 to read the contents of the DNA file
2) create a recursive function process::ByteString -> a that will call
itself.

       I have a few problems:

a) the DNA is 8MB long. How can I ensure the stack will hold a recursive
call?
b) there is an "abnormal ending" function called finish that is called
anywhere in the code. Is it a good approach to return Empty to end
processing?
c) should I go "monadic", keeping the dna on a state monad?


    Thanks


-- 
Rafael Gustavo da Cunha Pereira Pinto
Electronic Engineer, MSc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20080723/685d5101/attachment.htm

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

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


End of Beginners Digest, Vol 1, Issue 12
****************************************

Reply via email to