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? (Kim-Ee Yeoh)
   2. Re:  Capture the notion of invertible (Javran Cheng)
   3. Re:  do Haskell programs have fewer bugs? (Nadir Sampaoli)


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

Message: 1
Date: Thu, 20 Mar 2014 05:51:09 +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] do Haskell programs have fewer bugs?
Message-ID:
        <capy+zdqawmhwuxbweqjrhm2ngdfqjrx2uwt8qdgpq5sa3fm...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Thu, Mar 20, 2014 at 1:21 AM, Nadir Sampaoli <[email protected]>wrote:

> As the saying goes, less code means less potential for bugs :)
>
But you should look out for code golf, which isn't helpful.


> As someone who is still struggling to get past that learning phase where
> you only solve "simple" (usually one-liner) exercises, I'd like to ask you
> (and anyone reading this) how do you reason at a larger level?
>
There's a lot of low-lying fruit that's easily plucked leveraging
functional programming. I list the easiest ones that I know of here:

http://www.atamo.com/blog/low-lying-fruits-of-fp-1/

Of course, you still have to grapple and understand your specific problem
domain, whether it's web apps or auto music generation.


>  How do you work at a larger (module/project) level? Do you need to have
> mastered all the main monads (beyond list amd maybe) and monad transformers?
>
> Don't sweat them monads. The codebase for GHC doesn't even use monad
transformers iirc.

Sorry for the long rant.
>
Not at all. Haskell mailing lists used to have long, discursive
discussions, but somehow this one turned into some kind of rapid-fire Q&A.
Most of the interesting knowledge can't be unpacked in that format.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140320/5c2eb962/attachment-0001.html>

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

Message: 2
Date: Thu, 20 Mar 2014 02:18:12 -0400
From: Javran Cheng <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Capture the notion of invertible
Message-ID:
        <ca+tfdnaqvqzafbdnpurh3wfd0dus7zx8e37em7tvsdbc4ix...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

I've tried that lens lib out, and it is exactly what I want.

few examples in GHCi:

?> let pretty x = mapM_ print x
?> pretty mat
[1,0,0,0,2]
[0,3,0,4,0]
[0,0,5,0,0]
[0,6,0,7,0]
[8,0,0,0,9]
?> let shiftL = filter (/= 0) >>> (++ repeat 0) >>> take 5
?> over (iso transpose transpose) (map shiftL) mat
[[1,3,5,4,2],[8,6,0,7,9],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]
?> pretty $ over (iso transpose transpose) (map shiftL) mat
[1,3,5,4,2]
[8,6,0,7,9]
[0,0,0,0,0]
[0,0,0,0,0]
[0,0,0,0,0]
?> pretty $ over ((iso transpose transpose).(iso (map reverse) (map
reverse) )) (map shiftL) mat
[0,0,0,0,0]
[0,0,0,0,0]
[0,0,0,0,0]
[1,3,0,4,2]
[8,6,5,7,9]

Off topic:

In addition, as David Young commented in my codereview question:

"rempty and rappend form a Category instance. "

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"
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.

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?

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


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

Message: 3
Date: Thu, 20 Mar 2014 08:47:35 +0100
From: Nadir Sampaoli <[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:
        <cafywtdqccl71+3q8r5xgjjzp80n-gmymbnym-kyvbdseoqg...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Il 19/mar/2014 23:51 "Kim-Ee Yeoh" <[email protected]> ha scritto:
>
> There's a lot of low-lying fruit that's easily plucked leveraging
functional programming.

Thanks for the insight.
The "don't"s are most helpful. I have to constantly take myself from code
golfing and overcomplicating things for the sake of cleverness (especially
in a language that enables you so much).

>>
>> How do you work at a larger (module/project) level? Do you need to have
mastered all the main monads (beyond list amd maybe) and monad transformers?
>
> Don't sweat them monads. The codebase for GHC doesn't even use monad
transformers iirc.

My point was that when you're arranging new data types you'd probably
benefit from understanding/recognizing behavioral patterns (e.g a Reader, a
State-carrying data structure, etc.).
Nonetheless I think I understand your point in which keeping things flat
simple does come a long way to solving problems.

>
> Not at all. Haskell mailing lists used to have long, discursive
discussions, but somehow this one turned into some kind of rapid-fire Q&A.
Most of the interesting knowledge can't be unpacked in that format.

Eh, that would imply a certain level of knowledge on both side. The fact
that I'm stubborn and keep writing mails on a phone while train-commuting
doesn't help either.

>
> -- Kim-Ee
>

Thanks again,
Regards

Nadir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140320/75d809e1/attachment-0001.html>

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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 69, Issue 28
*****************************************

Reply via email to