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: sometimes Haskell isn't what you want (Dennis Raddle)
2. Re: sometimes Haskell isn't what you want (Anindya Mozumdar)
3. Re: Data.Char: isAlpha vs. isLetter (Brandon Allbery)
4. Re: Data.Char: isAlpha vs. isLetter (Brandon Allbery)
5. Data.Map: fromList (Stayvoid)
6. Re: Data.Map: fromList (Brandon Allbery)
----------------------------------------------------------------------
Message: 1
Date: Tue, 11 Sep 2012 05:16:15 -0700
From: Dennis Raddle <[email protected]>
Subject: Re: [Haskell-beginners] sometimes Haskell isn't what you want
To: Jay Sulzberger <[email protected]>
Cc: Haskell Beginners <[email protected]>
Message-ID:
<CAKxLvor__0rv6rOfEB77oL4mgv11Pz-=ka8fzcutfaqc2e7...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
I went briefly to Python but guess what? I I U-turned right back to
Haskell. Because there is nothing like the consistent documentation and
well-thought-out libraries of Haskell. There is nothing else like the help
from #haskell or this list. I used to program in Python. I went back to it
for one day (yesterday) and that was enough to make me realize how
unpleasant its inconsistencies, inconsistent documentation, awkwardnesses,
etc. Maybe Haskell will make me think harder but at least the whole
language and supporting documentation and the whole community has "got my
back." Haskell is a gift and I'm not throwing it away.
Yay!
On Mon, Sep 10, 2012 at 2:23 PM, Jay Sulzberger <[email protected]> wrote:
>
>
> On Sun, 9 Sep 2012, Dennis Raddle <[email protected]> wrote:
>
> Sadly, I've decided Haskell is not the right language for my current
>> project. Python is better. I need to hack together data, and strict typing
>> is getting in the way. Most of my algorithms are better served with
>> imperative/mutable-data. I learned a lot about Haskell trying to do it,
>> but
>> my knowledge of the language is not quiet good enough and I feel like I'm
>> fighting the language. Python is better. For now.
>>
>
> I always recommend Scheme.
>
> It is like Haskell in one respect:
>
> The Scheme Tribes keep the Ritual and the Law of Lambda.
>
> Scheme is different from Haskell in two respects:
>
> We Lispers do all our coding under the Great Functor, the Great
> Functor from Code to Objects in the Lisp World.
>
> For most Scheme systems, the Type Sub-System calculates less at
> compile time.
>
> Robert Harper has a new textbook available at
>
>
> http://www.cs.cmu.edu/~rwh/**plbook/book.pdf<http://www.cs.cmu.edu/~rwh/plbook/book.pdf>
>
> and here is a useful notice of the book
>
> http://blog.ezyang.com/2012/**08/practical-foundations-for-**
> programming-languages/<http://blog.ezyang.com/2012/08/practical-foundations-for-programming-languages/>
>
> ad missing the Great Functor: See remarks on "symbols" in the
> section 32.3 on page 321, and the discussion of observational
> equivalence in section 47.1 on page 498. A Lisper reading these
> sections might say "Ah, the Great Functor is worthy of study by
> New Type Theorists too. We Lispers consider a symbol to be a
> symbol first, and nothing else until you pass across one or more
> functors, and then the symbol might become many different
> things.".
>
> ad "dynamic typing" vs "static typing": Professor Harper's blog
> post
>
> http://existentialtype.**wordpress.com/2011/03/19/**
> dynamic-languages-are-static-**languages/<http://existentialtype.wordpress.com/2011/03/19/dynamic-languages-are-static-languages/>
>
> deals with this. I think the claim made, that "dynamic typing"
> is a special case of "static typing", is, when sympathetically
> read, right.
>
> oo--JS.
>
>
> ______________________________**_________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/**mailman/listinfo/beginners<http://www.haskell.org/mailman/listinfo/beginners>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20120911/b360c162/attachment-0001.htm>
------------------------------
Message: 2
Date: Tue, 11 Sep 2012 19:04:14 +0530
From: Anindya Mozumdar <[email protected]>
Subject: Re: [Haskell-beginners] sometimes Haskell isn't what you want
To: Dennis Raddle <[email protected]>
Cc: Haskell Beginners <[email protected]>
Message-ID:
<CADUR+2boDwjv25eFM_9Kbo_XQ4uUMn=syfjvvnuan7tgnb4...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
> I went back to it
> for one day (yesterday) and that was enough to make me realize how
> unpleasant its inconsistencies, inconsistent documentation, awkwardnesses,
> etc.
> Haskell is a gift and I'm not throwing it away.
Luckily this is a small list, otherwise a flame war would have started by now.
Personally, I learnt the basics of Haskell in the year 2000 in
college. I am re-learning it again, and it's an absolute delight. I am
not a programmer by profession - and this is the only language which
*makes* me want to learn it as I am generally interested in math and
bit of CS theory. It's also interesting to note that Haskell is being
used in finance, and maybe I will get to use it professionally one
day.
Regards,
Anindya
------------------------------
Message: 3
Date: Tue, 11 Sep 2012 11:10:52 -0400
From: Brandon Allbery <[email protected]>
Subject: Re: [Haskell-beginners] Data.Char: isAlpha vs. isLetter
To: Joey Hess <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
<cakfcl4xlksjwbck8phbfzkrp4abrecp9txya_7ypjompivz...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Tue, Sep 11, 2012 at 1:49 AM, Joey Hess <[email protected]> wrote:
> Brandon Allbery wrote:
> > Probably an alias for backward compatibility; isAlpha is C-style
> <ctype.h>
> > stuff, which was ASCII only, whereas isLetter is Unicode style.
>
> Prelude Data.Char> all (\c -> isLetter c == isAlpha c) [minBound..maxBound]
> True
>
> Whew! You had me worried my code had unicode bugs.
>
I phrased it as "*alias* for backward compatibility" for a reason. It
should be the same thing, but I expect older versions of Haskell used the
older name because it was well established in the pre-Unicode era. (I
couldn't say whether it was ever *native*; Haskell did not evolve in a
vacuum, there are other languages in its background.)
--
brandon s allbery [email protected]
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20120911/9d2bc6c5/attachment-0001.htm>
------------------------------
Message: 4
Date: Tue, 11 Sep 2012 11:15:16 -0400
From: Brandon Allbery <[email protected]>
Subject: Re: [Haskell-beginners] Data.Char: isAlpha vs. isLetter
To: Stayvoid <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
<cakfcl4uyte7-or9jvlpyxs9qz34gx3yz0spnrw1wusm7oxv...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Tue, Sep 11, 2012 at 1:52 AM, Stayvoid <[email protected]> wrote:
> > Probably an alias for backward compatibility; isAlpha is C-style
> <ctype.h>
> > stuff, which was ASCII only, whereas isLetter is Unicode style.
>
> Both Haskell functions support non-ASCII chars.
> Does it refute your assumption?
>
No, it demonstrates I need to be more explicit for some people.
I did not say isAlpha is ASCII-only, I said it was *created* in an
ASCII-only time when "isAlpha" was (the Haskell version of) the common name
for the operation. When the Char type became a Unicode codepoint instead
of an ASCII character, isAlpha would naturally have been widened to match
*and* the corresponding Unicode standard name was imported. Leaving it as
is would have introduced bugs (of the sort that the GHC I/O subsystem had
until ghc 6.12 or thenabouts, when it was finally made to use UTF8 instead
of "ASCII"/ISO 8859-1).
--
brandon s allbery [email protected]
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20120911/c819087d/attachment-0001.htm>
------------------------------
Message: 5
Date: Tue, 11 Sep 2012 20:59:37 +0400
From: Stayvoid <[email protected]>
Subject: [Haskell-beginners] Data.Map: fromList
To: beginners <[email protected]>
Message-ID:
<cak5fs_eqm-wqsanv5acb1jqd9tkm7dxzded3mj6ru9azw4w...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hello,
I'm reading learnyouahaskell.com.
There is an example: [1]
ghci> Map.fromList
[("betty","555-2938"),("bonnie","452-2928"),("lucille","205-2928")]
fromList [("betty","555-2938"),("bonnie","452-2928"),("lucille","205-2928")]
Why does Map.fromList represent its output like this?
Could you explain me the following definition?
data Map.Map k a
= Data.Map.Tip
| Data.Map.Bin !Data.Map.Size !k a !(Map.Map k a) !(Map.Map k a)
I guess that this fromList example is a bit premature.
The only parameterised type I know is this one:
data Maybe a = Nothing | Just a
[1] http://learnyouahaskell.com/modules#data-map
Thanks
------------------------------
Message: 6
Date: Tue, 11 Sep 2012 13:48:51 -0400
From: Brandon Allbery <[email protected]>
Subject: Re: [Haskell-beginners] Data.Map: fromList
To: Stayvoid <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
<cakfcl4v7jawgk7f28bzjrecex2qyy8cbnb8nhe8oeq8t1bd...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Tue, Sep 11, 2012 at 12:59 PM, Stayvoid <[email protected]> wrote:
> ghci> Map.fromList
> [("betty","555-2938"),("bonnie","452-2928"),("lucille","205-2928")]
> fromList
> [("betty","555-2938"),("bonnie","452-2928"),("lucille","205-2928")]
>
> Why does Map.fromList represent its output like this?
>
It doesn't; the Show instance for Data.Map, however, does a toAscList and
then wraps the resulting list in a fromList, because the internals of a Map
are deliberately hidden.
If the internals of Map were visible, it would be possible to build an
invalid Map; at best it would be unbalanced and slow, at worst it would be
misordered and keys would randomly go "missing" as a result. See, for
example, how (Map Double a) misbehaves (try searching the haskell-cafe list
for "Map Double"): the poorly defined Ord constraint on floating point
types, especially in the presence of NaN, means keys *do* sometimes go
missing in this case and (Map Double a) ends up being rather unreliable.
This also means you can break a Map by providing an incorrect or
inconsistent Ord instance for its key. This is why typeclass instances are
global; if there were local instances, you could do severe violence to a
Map by providing an incompatible/incoherent local Ord instance for the type
of its key.
data Map.Map k a
> = Data.Map.Tip
> | Data.Map.Bin !Data.Map.Size !k a !(Map.Map k a) !(Map.Map k a)
>
A node in a Map is either a Tip (placeholder of sorts) or a Bin comprising
a strict number of subnodes/values, a strict key and its associated value,
and strict left and right subtrees (which may be Tip-s if this is a leaf).
You should never try to work with this directly (and under normal
circumstances you can't, as the constructors are hidden), as outlined above.
--
brandon s allbery [email protected]
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20120911/996f62e8/attachment.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 51, Issue 16
*****************************************