Multivariant assignments generation language https://bitbucket.org/gltronred/multivariant#readme
|Latest on Hackage:||0.1.0.1|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
Multivariant assignments generation language
This library allows you to write short description of multivariant assignments in embedded DSL and interpret them as solution, text of assignment and tests.
This library is available at hackage.
- install stack
stack exec multivariant
or you can use
cabal install multivariant.
There are several typeclasses for tagless-final encoding of language:
Each typeclass defines some operations that every interpreter has to implement.
There are currently three ``interpreters’’ (types that implement corresponding typeclasses):
task = Inv.map ((+1) :<->: (-1)) `withDescription` "Add one to each list element" `withCornerCases` (,) ~> ( (sum :<->: (\s -> [s,0])) `withDescription` "Compute sum of elements" `withCornerCases` ([],) <+++> (product :<->: (\p -> [1,p])) `withDescription` "Compute product of elements" `withCornerCases` ([],) )
More examples are available in the examples directory.