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: do Haskell programs have fewer bugs? (emacstheviking)
2. Re: Capture the notion of invertible (Brent Yorgey)
3. What to do next? (bruce li)
4. Re: What to do next? (Bob Ippolito)
5. Re: What to do next? (Mateusz Kowalczyk)
----------------------------------------------------------------------
Message: 1
Date: Thu, 20 Mar 2014 13:36:34 +0000
From: emacstheviking <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] do Haskell programs have fewer bugs?
Message-ID:
<caeieuul7+mamkijtthhxx-fr7+hoebteaoskwwvaosdnf2h...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On the nail!
That's exactly how I feel about using Haskell and it is the same feeling I
had when I learned Lisp... for some reason you feel much more connected
with the nature of the problem and therefore more aware / focused /
cognisant of "what you are doing".
I found that part of the reason, at leat for me, was the need to write
"efficient" code, and that means taking time to read the libraries to see
what is already available and thus you come across more than one potential
way to solve your problem and thus have to think about it more.
I think that Lisp and Haskell (and other languages that promote higher
order programming) allow for powerful abstractions that result in functions
like "map, filter, reject, fold" etc and thus remove theneed for manually
writing loops in the code. That was part of the appeal for me, not coding
loops!
:)
Sean.
On 19 March 2014 17:09, Dennis Raddle <[email protected]> wrote:
> I was thinking about why it seems I can write Haskell code without bugs in
> a much easier way than imperative languages. Part of it is the strict
> type-checking, but I think there is something more. It's the potential for
> conciseness. I work hard when programming in Haskell to take advantage of
> language features that make my program concise. Somehow this leads me to
> think about it in a certain way. I know I'm on track as it gets smaller and
> smaller. And as it gets smaller, it leads me to think about my logic's
> cases and things like that. Certain patterns show up and I think about what
> those patterns mean for the structure of my problem.
>
> By the time I'm done with all that, I've analyzed my problem much more
> thoroughly than I would ever do in an imperative language.
>
> Dennis
>
>
> _______________________________________________
> 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/20140320/d2054220/attachment-0001.html>
------------------------------
Message: 2
Date: Thu, 20 Mar 2014 09:47:30 -0400
From: Brent Yorgey <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Capture the notion of invertible
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Thu, Mar 20, 2014 at 02:18:12AM -0400, Javran Cheng wrote:
> Off topic:
This is not off topic for the beginners list at all. =)
> This comment makes perfect sense to me, because "monoid-like" reminds
> me of Data.Monoid,
> which does not totally capture what I know about monoid: monad is
> "just a monoid in the category of endofunctors"
The "monoid" being referred to here is a very generalized sense of the
word, and is quite different from (though distantly related to)
Haskell's Monoid type class.
> but Monad is not in any sense fit into a Monoid.
> Here I find that when I talk about "monoid-like", I actually refer to
> Category,
> and Monad is an instance of Category, which backs up my guess.
"Monad is an instance of Category" --- this doesn't really make
sense as stated. It's certainly not true that every instance of Monad
is also an instance of Category; the kinds don't even match. It is
true that you can build a Category out of a Monad, though there are
actually several ways to do so. The most well-known in the Haskell
world is Kleisli, but there are other ways.
> In a word, can I say that when talking about reducing data (Sum,
> Product, etc.), I'm referring to Monoid,
> and when I talking about monoid-like composition, I'm referring to
> Category?
"monoid-like composition" can refer to Monoid too. The essential
difference is *types*: in particular you can think of a Category as a
"typed Monoid": with a Monoid, *any* two things can be composed. With
a Category, you can only compose things whose types match. So
conversely you can also think of a Monoid as a "Category with only one
type". As an (easy) exercise:
newtype Endomorphism cat a = E (cat a a)
instance Category cat => Monoid (Endomorphism cat a) where
...
-Brent
>
> Javran
>
> > Date: Tue, 18 Mar 2014 02:48:21 +0700
> > From: Kim-Ee Yeoh <[email protected]>
> > To: The Haskell-Beginners Mailing List - Discussion of primarily
> > beginner-level topics related to Haskell <[email protected]>
> > Subject: Re: [Haskell-beginners] Capture the notion of invertible
> > functions
> > Message-ID:
> > <CAPY+ZdTyj81gcUaZJfHGeta8rbjxup8ReKHJ=iy7epzkkqp...@mail.gmail.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > > When you're talking about invertible functions, the idea you're probably
> > reaching for is an isomorphism -- that is, we want the function to have
> > certain nice properties on top of just being a map from a -> b with an
> > inverse map from b -> a.
> >
> > The usual meaning of 'f is invertible' is that it is both left- and
> > right-invertible, thus making it bijective: see first bullet in [1].
> >
> > Here you're alluding to f being merely left-invertible, something I don't
> > see mentioned in OP.
> >
> > > You also want the function to be a bijection, which is captured in the
> > notion of an isomorphism.
> >
> > I'm reminded of a reddit convo where the idea was tossed out that
> > semigroups should always be promoted to monoids [2].
> >
> > I argued no. I also cited a case where a supposedly nicer monoid causes
> > more problems for a ghc hacker than the true semigroup [3].
> >
> > Having structure is nice. And sometimes we just have to work with what's
> > given to us.
> >
> > Category theory calls a /monomorphism/ something that's strictly weaker
> > than left-invertible. An arrow that's (additionally) left-invertible
> > corresponds to a /split mono/.
> >
> > Hence in order of _decreasing_ niceness: Iso, Split mono, Mono. As research
> > uncovers more interesting phenomena, this sequence will continuing growing
> > to the right.
> >
> > We can't always impose that niceness because that nukes whatever we're
> > studying. So we gotta respect the situation. And given lemons, make
> > lemonade.
> >
> >
> > [1]
> > http://en.wikipedia.org/wiki/Bijection,_injection_and_surjection#Bijection
> >
> > [2]
> > http://www.reddit.com/r/haskell/comments/1ou06l/improving_applicative_donotation/ccvtqot?context=1
> >
> > [3]
> > http://www.reddit.com/r/haskell/comments/1ou06l/improving_applicative_donotation/ccy4n2d
>
>
>
>
>
> --
> Javran (Fang) Cheng
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
------------------------------
Message: 3
Date: Thu, 20 Mar 2014 14:17:37 -0400
From: bruce li <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] What to do next?
Message-ID:
<CAGmT-V7Yj+hiv=whlqz4f4ddse+07j7encsmydwlhu_pbui...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi, there,
I'm relatively new to Haskell...well... I mean I haven't done anything I
believe truely in Haskell. I have gone through materials like Learn You a
Haskell for Real Good, Real World Haskell, most chapters in Haskell
Wikibook, Write Yourself Scheme in 48 Hours, Algorithms: A Functional
Approach and other materials in Haskell Wiki.
*But... what I feel is that I'm not confident while writing Haskell
code.*Having gone through all those materials with "magic", I always
feel I'm
writing stupid code and there must be more elegant way... And... what's
worse, I feel guilty while using IO monad but I simply cannot avoid it,
like when I try to write code generator for a toy compiler, I need to keep
state of the registers, which I need IORef... Then I feel its not pure
anymore but I don't know how to get around it.
I'm wondering if anyone else shares this kind of feeling and what should I
do next? Could anyone suggest any project to get hands on experience with
Haskell?
Another question is that the deeper digging into functional algorithms
design (reading the book Pearls of Functional Algorithm Design), the more
ignorant I feel. So how do I make up the basics like fold law, list
induction etc. Any suggested reading materials?
Well.. I think that's a lot question. Thanks for your patience and your
kind help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140320/17acc881/attachment-0001.html>
------------------------------
Message: 4
Date: Thu, 20 Mar 2014 11:29:20 -0700
From: Bob Ippolito <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] What to do next?
Message-ID:
<cacwmpm-hvsd0r1fuyv5l+mdhz1952tp1mktevjfku5h3ogz...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
I got a lot out of reading Parallel and Concurrent Programming in Haskell
by Simon Marlow. Purely Functional Data Structures by Chris Okasaki is also
quite useful. Haskell wasn't my first pure-ish FP language (I spent a lot
of time in Erlang) so for me it was really about wrapping my head around
Haskell's non-strict evaluation.
You could also try going through the exercises at http://exercism.io/ -
none of the exercises are too challenging but the code review component of
the site will keep you honest and will likely help you get closer to
writing better Haskell.
On Thu, Mar 20, 2014 at 11:17 AM, bruce li <[email protected]> wrote:
> Hi, there,
> I'm relatively new to Haskell...well... I mean I haven't done anything I
> believe truely in Haskell. I have gone through materials like Learn You a
> Haskell for Real Good, Real World Haskell, most chapters in Haskell
> Wikibook, Write Yourself Scheme in 48 Hours, Algorithms: A Functional
> Approach and other materials in Haskell Wiki.
>
> *But... what I feel is that I'm not confident while writing Haskell
> code.*Having gone through all those materials with "magic", I always feel I'm
> writing stupid code and there must be more elegant way... And... what's
> worse, I feel guilty while using IO monad but I simply cannot avoid it,
> like when I try to write code generator for a toy compiler, I need to keep
> state of the registers, which I need IORef... Then I feel its not pure
> anymore but I don't know how to get around it.
>
> I'm wondering if anyone else shares this kind of feeling and what should I
> do next? Could anyone suggest any project to get hands on experience with
> Haskell?
>
> Another question is that the deeper digging into functional algorithms
> design (reading the book Pearls of Functional Algorithm Design), the more
> ignorant I feel. So how do I make up the basics like fold law, list
> induction etc. Any suggested reading materials?
>
> Well.. I think that's a lot question. Thanks for your patience and your
> kind help.
>
> _______________________________________________
> 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/20140320/77dffaa5/attachment-0001.html>
------------------------------
Message: 5
Date: Thu, 20 Mar 2014 19:08:35 +0000
From: Mateusz Kowalczyk <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] What to do next?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
On 20/03/14 18:17, bruce li wrote:
> Hi, there,
> I'm relatively new to Haskell...well... I mean I haven't done anything I
> believe truely in Haskell. I have gone through materials like Learn You a
> Haskell for Real Good, Real World Haskell, most chapters in Haskell
> Wikibook, Write Yourself Scheme in 48 Hours, Algorithms: A Functional
> Approach and other materials in Haskell Wiki.
>
> *But... what I feel is that I'm not confident while writing Haskell
> code.*Having gone through all those materials with "magic", I always
> feel I'm
> writing stupid code and there must be more elegant way... And... what's
> worse, I feel guilty while using IO monad but I simply cannot avoid it,
> like when I try to write code generator for a toy compiler, I need to keep
> state of the registers, which I need IORef... Then I feel its not pure
> anymore but I don't know how to get around it.
>
> I'm wondering if anyone else shares this kind of feeling and what should I
> do next? Could anyone suggest any project to get hands on experience with
> Haskell?
>
> Another question is that the deeper digging into functional algorithms
> design (reading the book Pearls of Functional Algorithm Design), the more
> ignorant I feel. So how do I make up the basics like fold law, list
> induction etc. Any suggested reading materials?
>
> Well.. I think that's a lot question. Thanks for your patience and your
> kind help.
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
I recommend that you try and help out with existing libraries. Writing
patches for libs is very easy in Haskell as it's quite hard to break
everything by not setting that one obscure global variable there
somewhere ;)
Toy problems only get you so far, and this way others will benefit too.
--
Mateusz K.
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 69, Issue 29
*****************************************