IxpertaSolutions / freer-effects

An implementation of "Freer Monads, More Extensible Effects".
BSD 3-Clause "New" or "Revised" License
65 stars 12 forks source link

TemplateHaskell for convenience funtions #16

Open xkollar opened 7 years ago

xkollar commented 7 years ago

Let us have a look at the example code.

data Console s where
    PutStrLn :: String -> Console ()
    GetLine :: Console String

putStrLn :: Member Console r => String -> Eff r ()
putStrLn = send . PutStrLn

getLine :: Member Console r => Eff r String
getLine = send GetLine

It seems like putStrLn and getLine is very boilerplaty and could be generated by TH.

xkollar commented 7 years ago

Note to self: create two functions:

Reasoning behind this:

isovector commented 7 years ago

I have a (very) WIP proof of concept of this here: https://github.com/IxpertaSolutions/freer-effects/compare/master...TaktInc:feature/th?expand=1

should have it done by the end of the week