Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/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: Lazyness and forM_ (Marc Busqué)
----------------------------------------------------------------------
Message: 1
Date: Fri, 13 Apr 2018 15:32:27 +0200 (CEST)
From: Marc Busqué <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Lazyness and forM_
Message-ID: <alpine.LNX.2.21.1804131520060.7309@localhost>
Content-Type: text/plain; charset="iso-8859-15"; Format="flowed"
On Fri, 13 Apr 2018, Kim-Ee Yeoh wrote:
> Well,
>
> forM_ (categories, expenses) $ withDB . createTable
>
> is equivalent to
>
> withDB . createTable $ expenses.
>
> So exactly one table is created.
Oops, you are right.
> ```
> ["a", "b"] `forM_` print
> ```
>
> Actually prints both `"a"` and `"b"`.
>
>
> Here the code uses square brackets--and so we have honest-to-goodness
> lists--whereas the previous used parentheses.
>
> See what happens with: ("a","b") `forM_` print.
Now I feel embarrassed I overlooked that :)
I used a tuple instead of a list because in selda `Table` are type-safe.
So `categories` and `expenses` are different types and they can't go in
the same list.
So I guess, once the `forM_` mistery is gone, I can boil down my problem
to something very different. As it has nothing to do with the current
subject, I'll submit another question.
> Marc: Feel free to write to the haskell-cafe mailing list for questions such
> as this. Fortuitously in this case, it turns out that your query
> needed knowledge only about the forM* combinators and--ever since their ilk
> was generalized--the known instances declared for the Traversable
> constraint. As you explore the domain-specific package "selda" further, you
> will find more people acquainted with the package over at the cafe
> than here in beginners. Suffice to say, everyone here in this list is also in
> cafe, which is also open to beginners questions.
And following your recommendation I'll submit that question in the
haskell-cafe mailing list :)
Thank you very much for your help :)
Marc Busqué
http://waiting-for-dev.github.io/about/
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 118, Issue 9
*****************************************