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: How do you pronounce these operators? (Thiago Negri)
2. Re: How do you pronounce these operators? (David Thomas)
3. Re: Data type definition for a list of elements of
alternating types? (Brent Yorgey)
4. Re: Data type definition for a list of elements of
alternating types? (Denis Kasak)
5. Re: How do you pronounce these operators? (Tony Morris)
6. Re: Data type definition for a list of elements of
alternating types? (Jacek Dudek)
----------------------------------------------------------------------
Message: 1
Date: Thu, 3 Apr 2014 12:36:25 -0300
From: Thiago Negri <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How do you pronounce these operators?
Message-ID:
<cablneztwp2xuo6oencrcp8t9amquyen3-bbgrfq8-ybj86u...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
As far as I know, there are no standard out there for this.
As Haskell allows to define custom operators, they tend to add up pretty
quick and it's completely optional to give it a pronounceable name.
Maybe we can propose a syntax to define a pronounceable name next to an
operator, and make emacs say it out loud each time you type it (missed
april's fool release notes).
As Kim-Ee said, a quick search can bring good content into the matter:
HaskellWiki has a page about this:
http://www.haskell.org/haskellwiki/Pronunciation
The HaskellWiki points to a thread:
www.haskell.org/pipermail/haskell-cafe/2008-January/038756.html
And there's a question at Stackoverflow:
http://stackoverflow.com/questions/7746894/are-there-pronounceable-names-for-common-haskell-operators
Hope it can help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140403/4b86a48e/attachment-0001.html>
------------------------------
Message: 2
Date: Thu, 3 Apr 2014 10:17:31 -0700
From: David Thomas <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] How do you pronounce these operators?
Message-ID:
<cajudvcijgsv4jty5+lnjdx4zu2ygskka+igs1eve5jzkq-v...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
For things that have a textual equivalent, I tend to use that (possibly
"infix X" or "X operator" if it's not clear from context) even if the
equivalent is more or less specialized than the operator. For <*> in
particular, that is "ap".
On Apr 3, 2014 6:29 AM, "John M. Dlugosz" <[email protected]> wrote:
> I'm having some difficult reading because I don't have "names" for many of
> the operators, such as <*>. I know that >>= is pronounced "bind", but what
> about the others? Is there some common consensus, a list somewhere, or at
> least the proper mathematical names to serve as a starting point?
>
> I'd hate to have to make something up (see < http://www.muppetlabs.com/~
> breadbox/intercal-man/tonsila.html >)
>
> --John
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140403/fe2ed97e/attachment-0001.html>
------------------------------
Message: 3
Date: Thu, 3 Apr 2014 16:58:18 -0400
From: Brent Yorgey <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Data type definition for a list of
elements of alternating types?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Wed, Apr 02, 2014 at 09:52:21PM -0400, Jacek Dudek wrote:
> -- As an exercise I wanted to define a datatype that is an alternating
> list of elements of two different types. The best that I could do are
> the type definitions below:
>
> module BiList
> ( BiList (..)
> , AList (EmptyA)
> , BList (EmptyB)
> ) where
>
> data BiList a b
> = Empty
> | BA (AList a b)
> | BB (BList a b)
>
> data AList a b
> = EmptyA
> | AL a (BList a b)
>
> data BList a b
> = EmptyB
> | BL b (AList a b)
>
> (<#) :: a -> (BList a b) -> (AList a b)
> a <# bs = AL a bs
>
> (<@) :: b -> (AList a b) -> (BList a b)
> b <@ as = BL b as
>
> infixr 5 <#
> infixr 5 <@
>
> example :: BiList Int Char
> example = BA $ 1 <# 'a' <@ 2 <# 'b' <@ 3 <# 'c' <@ 4 <# 'd' <@ EmptyA
As David McBride noted, AList and BList are isomorphic (up to the
order of their arguments) so you don't need both. Unfortunately you
do still need BiList; but you don't need its Empty. So:
data BiList a b
= BA (AltList a b)
| BB (AltList b a)
data AltList a b
= Empty
| Cons a (AltList b a)
So this addresses (2) but not (1). I don't think there is any way
around the need for (1). (Note, however, that you do still have two
distinct representations of the empty list: BA Empty and BB Empty. I
can't see any way around that either.)
-Brent
------------------------------
Message: 4
Date: Thu, 3 Apr 2014 23:43:59 +0200
From: Denis Kasak <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Data type definition for a list of
elements of alternating types?
Message-ID:
<canjrnzdzououjbcdcqz30o9w0xdnvxruimqhcdqfhy0udbn...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
On 3 April 2014 22:58, Brent Yorgey <[email protected]> wrote:
>
> data BiList a b
> = BA (AltList a b)
> | BB (AltList b a)
>
> data AltList a b
> = Empty
> | Cons a (AltList b a)
>
> So this addresses (2) but not (1). I don't think there is any way
> around the need for (1). (Note, however, that you do still have two
> distinct representations of the empty list: BA Empty and BB Empty. I
> can't see any way around that either.)
You could move the Empty constructor to BiList while making AltList a
non-empty list, i.e.
data BiList a b
= Empty
| BA (AltList a b)
| BB (AltList b a)
data AltList a b
= Elem a
| Cons a (AltList b a)
--
Denis Kasak
------------------------------
Message: 5
Date: Fri, 04 Apr 2014 14:32:20 +1300
From: Tony Morris <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] How do you pronounce these operators?
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
On 04/04/14 03:28, Kim-Ee Yeoh wrote:
>
> On Wed, Apr 2, 2014 at 6:08 AM, John M. Dlugosz
> <[email protected] <mailto:[email protected]>> wrote:
>
> I'm having some difficult reading because I don't have "names" for
> many of the operators, such as <*>. I know that >>= is pronounced
> "bind", but what about the others? Is there some common
> consensus, a list somewhere, or at least the proper mathematical
> names to serve as a starting point?
>
>
> Did you try a search? There are links out there.
>
> But it's true that a search will only get you so far. I think what we
> don't have enough is idiomatic English coupled to idiomatic Haskell.
>
> It's like a proof/program of a proposition in Euclidean geometry. One
> just gets it visually and doesn't really bother with verbalizing on
> the tongue.
>
> Provide a code fragment here, and folks will help you with it.
>
> -- Kim-Ee
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
I have heard the following for (<*>)
* angle butt
* spaceship
* apply
* ap
* angry eye
--
Tony Morris
http://tmorris.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140404/07c238c0/attachment-0001.html>
------------------------------
Message: 6
Date: Thu, 3 Apr 2014 22:04:04 -0400
From: Jacek Dudek <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Data type definition for a list of
elements of alternating types?
Message-ID:
<CAJxg2_ENT+TOCVdSbKvSWuzdre0jJgn3JKFLp5wVHJJiK=j...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Thanks David, that's really clever! I was trying to do it without any
auxiliary data types, but couldn't see how I could use an instance of
(BiList a b) in the constructor expression for (BiList a b) without
losing the property that the list elements alternate from one type to
the other with each new element.
But now I see that when you write (BiList b a) in the constructor
expression, that's written in the context provided by the (data BiList
a b) line, so having the type variables in the opposite order makes
all the difference.
Brent, David's definition actually solved both (1) and (2), try it out!
On 4/3/14, Denis Kasak <[email protected]> wrote:
> On 3 April 2014 22:58, Brent Yorgey <[email protected]> wrote:
>>
>> data BiList a b
>> = BA (AltList a b)
>> | BB (AltList b a)
>>
>> data AltList a b
>> = Empty
>> | Cons a (AltList b a)
>>
>> So this addresses (2) but not (1). I don't think there is any way
>> around the need for (1). (Note, however, that you do still have two
>> distinct representations of the empty list: BA Empty and BB Empty. I
>> can't see any way around that either.)
>
> You could move the Empty constructor to BiList while making AltList a
> non-empty list, i.e.
>
> data BiList a b
> = Empty
> | BA (AltList a b)
> | BB (AltList b a)
>
> data AltList a b
> = Elem a
> | Cons a (AltList b a)
>
> --
> Denis Kasak
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 70, Issue 6
****************************************