dorchard / effect-monad

Provides 'graded monads' and 'parameterised monads' to Haskell, enabling fine-grained reasoning about effects.
BSD 2-Clause "Simplified" License
99 stars 11 forks source link

Why not a bit of Template Haskell for Var introduction? #4

Closed rrnewton closed 6 years ago

rrnewton commented 8 years ago

I.e. instead of:

x_var = Var::(Var "x")

Perhaps $(var x) at each use site of x_var?

E.g. in this example.

dorchard commented 8 years ago

Good question. I believe that Type Application in GHC 8 meets this need well. Var @ "x" I think would be the right syntax. I will try to do an update of this example using this style at some point.

dorchard commented 6 years ago

There is now an example of this: https://github.com/dorchard/effect-monad/blob/master/examples/ExtensibleState.hs

I think that the type application approach is preferable to adding Template Haskell (in terms of overhead) but it could make a nice option still as a module?