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. stream of monadic calculations (Christopher Howard)
2. Re: stream of monadic calculations (Daniel Trstenjak)
3. Re: stream of monadic calculations (Felipe Almeida Lessa)
4. Re: stream of monadic calculations (Felipe Almeida Lessa)
5. Re: stream of monadic calculations (Nick Vanderweit)
6. looking for an haskell job (Why NotSmile)
7. Re: looking for an haskell job (Christopher Howard)
8. Re: looking for an haskell job (Michael Orlitzky)
9. Netwire fromRational (Nathan H?sken)
10. Re: looking for an haskell job (Henk-Jan van Tuyl)
11. Re: looking for an haskell job (Daniel Hlynskyi)
----------------------------------------------------------------------
Message: 1
Date: Tue, 02 Oct 2012 10:12:44 -0800
From: Christopher Howard <[email protected]>
Subject: [Haskell-beginners] stream of monadic calculations
To: Haskell Beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Say I've got a stream of monadic calculations, like so:
code:
--------
do a' <- f a
a'' <- g a'
a''' <- h a''
return a'''
--------
There is a cleaner way to do that, yes? (Without using all the tick marks?)
--
frigidcode.com
indicium.us
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20121002/c1d42237/attachment-0001.pgp>
------------------------------
Message: 2
Date: Tue, 2 Oct 2012 20:13:39 +0200
From: Daniel Trstenjak <[email protected]>
Subject: Re: [Haskell-beginners] stream of monadic calculations
To: Christopher Howard <[email protected]>
Cc: Haskell Beginners <[email protected]>
Message-ID: <20121002181339.GA8639@machine>
Content-Type: text/plain; charset=us-ascii
Hi Christopher,
On Tue, Oct 02, 2012 at 10:12:44AM -0800, Christopher Howard wrote:
> Say I've got a stream of monadic calculations, like so:
>
> code:
> --------
> do a' <- f a
> a'' <- g a'
> a''' <- h a''
> return a'''
> --------
>
> There is a cleaner way to do that, yes? (Without using all the tick marks?)
foldM (\a f -> f a) a [f, g, h]
Greetings,
Daniel
------------------------------
Message: 3
Date: Tue, 2 Oct 2012 15:15:04 -0300
From: Felipe Almeida Lessa <[email protected]>
Subject: Re: [Haskell-beginners] stream of monadic calculations
To: Christopher Howard <[email protected]>
Cc: Haskell Beginners <[email protected]>
Message-ID:
<CANd=OGHwLHoJPvxPe=ogr8csz1-t9rbtdh6xhgyboufcwl1...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
You may use >>=:
f a >>= g >>= h
Or you may use >=> (from Control.Monad):
(f >=> g >=> h) a
Cheers,
--
Felipe.
------------------------------
Message: 4
Date: Tue, 2 Oct 2012 15:16:03 -0300
From: Felipe Almeida Lessa <[email protected]>
Subject: Re: [Haskell-beginners] stream of monadic calculations
To: Christopher Howard <[email protected]>, Haskell
Beginners <[email protected]>
Message-ID:
<CANd=ogfuy_rkogpz2x7zebue+qtrixbcy6ojgg__8vkfngz...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
On Tue, Oct 2, 2012 at 3:13 PM, Daniel Trstenjak
<[email protected]> wrote:
> foldM (\a f -> f a) a [f, g, h]
This solution will work only if f, g and h all have the same types.
Cheers,
--
Felipe.
------------------------------
Message: 5
Date: Tue, 02 Oct 2012 13:14:12 -0600
From: Nick Vanderweit <[email protected]>
Subject: Re: [Haskell-beginners] stream of monadic calculations
To: [email protected]
Message-ID: <1715301.KZtQZRS9jz@euler>
Content-Type: text/plain; charset="us-ascii"
Let's look at the analogous case:
let a' = f a
a'' = g a'
a''' = h a''
in <something to do with a'''>
Here, the way we would shorten "apply f, then apply g, then apply h" is using
the function composition operator, (.), whose type signature is:
(.) :: (b -> c) -> (a -> b) -> a -> c
So instead of the above, we could say:
let a''' = h . g . f $ a
Similarly, you have some functions:
f :: a -> m b
g :: b -> m c
for some monad m. And what you'd like to do is, in some sense, to compose
these, to get:
g . f :: a -> m c
But you can't exactly do that with the Prelude composition operator; the types
are wrong. Fortunately, smart people have already thought about how to
generally compose function-like things. The way you do this in a monad-specific
way is to use the (<=<) operator from Control.Monad, whose signature is:
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
And so that's really what you want: h <=< g <=< f $ a.
More generally, this whole idea of composing things that are similar to
functions is encapsulated by the notion of a category, and this can be viewed
as a specific case of using the composition operator from Control.Category. In
this case, the function-like things (called "arrows" or "morphisms") being
composed are the so-called Kleisli arrows, which are really the functions
you're manipulating here, f :: a -> m b.
Nick
On Tuesday, October 02, 2012 10:12:44 AM Christopher Howard wrote:
> Say I've got a stream of monadic calculations, like so:
>
> code:
> --------
> do a' <- f a
> a'' <- g a'
> a''' <- h a''
> return a'''
> --------
>
> There is a cleaner way to do that, yes? (Without using all the tick marks?)
------------------------------
Message: 6
Date: Tue, 2 Oct 2012 21:34:51 +0200
From: Why NotSmile <[email protected]>
Subject: [Haskell-beginners] looking for an haskell job
To: [email protected]
Message-ID:
<caco58fuc8+06avybl2aguoytuqm3gfyvv_mqed5r3juqra1...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi all,
even if I'm a newbie into the haskell world I'd like to start my next job
with it.
If anyone is searching for such a profile please contact me.
My zipped resume (more details in private):
- 7 yrs of experience
- c++, c#
- agile
- available to relocate
cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20121002/3106a44f/attachment-0001.htm>
------------------------------
Message: 7
Date: Tue, 02 Oct 2012 14:17:25 -0800
From: Christopher Howard <[email protected]>
Subject: Re: [Haskell-beginners] looking for an haskell job
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
On 10/02/2012 11:34 AM, Why NotSmile wrote:
> Hi all,
> even if I'm a newbie into the haskell world I'd like to start my next
> job with it.
>
> If anyone is searching for such a profile please contact me.
>
> My zipped resume (more details in private):
> - 7 yrs of experience
> - c++, c#
> - agile
> - available to relocate
>
>
> cheers
>
Related question: If someone was looking to hire a Haskell programmer,
what list would they post to? (Not the haskell-beginners list, I'm
guessing.)
--
frigidcode.com
indicium.us
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20121002/f3874226/attachment-0001.pgp>
------------------------------
Message: 8
Date: Tue, 02 Oct 2012 18:28:08 -0400
From: Michael Orlitzky <[email protected]>
Subject: Re: [Haskell-beginners] looking for an haskell job
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
On 10/02/2012 06:17 PM, Christopher Howard wrote:
>
> Related question: If someone was looking to hire a Haskell programmer,
> what list would they post to? (Not the haskell-beginners list, I'm
> guessing.)
>
There are frequent job posts on haskell-cafe.
------------------------------
Message: 9
Date: Wed, 03 Oct 2012 10:11:35 +0200
From: Nathan H?sken <[email protected]>
Subject: [Haskell-beginners] Netwire fromRational
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
Hey,
I noticed than when using this code:
(-1.0) . isKeyPressed leftKeyCode <|> 0.0
instead of
(pure (-1.0)) . isKeyPressed leftKeyCode <|> (pure 0.0)
than "fromRational" gets called. I am wondering, if this is not pretty
inefficient.
I am noticing this, because when I compile a netwire test program with
haste, the first code segment fails during runtime because of the primOp
newByteArray#.
Regards,
Nathan
------------------------------
Message: 10
Date: Wed, 03 Oct 2012 11:01:34 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] looking for an haskell job
To: [email protected], "Christopher Howard"
<[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
delsp=yes
On Wed, 03 Oct 2012 00:17:25 +0200, Christopher Howard
<[email protected]> wrote:
> Related question: If someone was looking to hire a Haskell programmer,
> what list would they post to? (Not the haskell-beginners list, I'm
> guessing.)
http://www.haskellers.com/jobs
http://cufp.org/jobs/language/31
Regards,
Henk-Jan van Tuyl
--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--
------------------------------
Message: 11
Date: Wed, 3 Oct 2012 12:10:06 +0300
From: Daniel Hlynskyi <[email protected]>
Subject: Re: [Haskell-beginners] looking for an haskell job
Cc: [email protected]
Message-ID:
<CANZg+yc6Z-_ie=wxkotpsot91lash87xusx-5wlb2jqrrrq...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Even more interesting question: are newbies allowed to get money for
programming in Haskell? Newbies tend to create bad code in simple
languages, like Java or Python, imagine what sort of sh*t can be produced
in Haskell!
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20121003/f5023a4a/attachment.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 52, Issue 3
****************************************