Pattern synonyms and record fields for Cont, Writer, Reader, State, ...

Baldur Blöndal baldurpet at gmail.com
Tue Nov 22 21:07:08 UTC 2016


This [1] was posted 5 hours ago

[1]
https://www.reddit.com/r/haskellquestions/comments/5ebepq/perhaps_i_meant_one_of_these_statet/

2016-11-20 17:56 GMT+00:00 David Feuer <david.feuer at gmail.com>:

> This sounds fantastic! I think it is very important to provide sufficient
> documentation in the source to allow newish users who click through to
> understand as much as they need.
>
> On Nov 20, 2016 12:47 PM, "Baldur Blöndal" <baldurpet at gmail.com> wrote:
>
>> This will look like the original definitions [1]
>>
>> > newtype State s a = State { runState :: s -> (a, s) }
>>
>> before they became type synonyms
>>
>> > type State s = StateT s Identity
>>
>> by defining pattern synonyms
>>
>> > pattern State :: (s -> (a, s)) -> State s a
>> > pattern State {runState} <- S.runState -> runState
>> >   where State a           = state a
>>
>> Trac ticket #12767 for further information. [2]
>>
>> [1] http://book.realworldhaskell.org/read/monads.html#id643643
>> [2] https://ghc.haskell.org/trac/ghc/ticket/12767
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20161122/7d005c99/attachment.html>


More information about the Libraries mailing list