Next meeting: ft Reader and more Applicative

0 views
Skip to first unread message

Linux Mercedes

unread,
Mar 10, 2019, 6:46:56 PM3/10/19
to The™ Reading Consortium
Folks,

For next week's meeting, we'll be covering Ch. 22: Reader in HPFP. I'd
also recommend Programming with Monads [0] from Real World Haskell.

In addition, we also plan to do a bit more reading on Applicative, since
that will be important in later chapters. Fortunately, Reader already
has a good deal about applicative in it! In addition, I'll recommend
having a look over Applicative Programming with Effects [1] by McBride
and Patterson.

See y'all next week!
--ℕ

[0]: http://book.realworldhaskell.org/read/programming-with-monads.html
[1]: http://www.staff.city.ac.uk/~ross/papers/Applicative.html

Linux Mercedes

unread,
Mar 10, 2019, 11:13:10 PM3/10/19
to The™ Reading Consortium
I also found "Desugaring Haskell's Do-notation into Applicative
Operations" [0] by Marlow et. al. to be interesting! The interesting
bits are in sections 1, 2, 5, and 6.

--ℕ

[0]:
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/08/desugaring-haskell-haskell16.pdf

Linux Mercedes

unread,
Mar 16, 2019, 6:29:20 PM3/16/19
to The™ Reading Consortium
So, since we've decided to postpone meeting (get better soon, y'all <3),
I have an opportunity to bring up a more interesting Reader exercise:

Write an evaluation function for the following data type:

data Arith =
Const Int
| Var String
| Negate Arith
| Plus Arith Arith
| Times Arith Arith

type Env = ???

eval :: Arith -> Reader Env Int
eval = ???

-- Example
ex = let x = Var "x"
in (x `Times` x) `Plus` ((Const 2) `Times` x) `Plus` (Const 1)

environment = ???

ex_value = run (eval ex) environment -- e.g., if x=3 in your
environment, then ex_value=16.

It might also be instructive to write eval without using Reader to see
what the differences are. (Or you could check my github where there is a
reader-free version of something similar...)

--ℕ

On 3/10/19 5:46 PM, Linux Mercedes wrote:
Reply all
Reply to author
Forward
0 new messages