multivariant

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.

BSD3 licensed by Anton Marchenko, Mansur Ziatdinov
Maintained by gltronred@gmail.com

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.

Installation

  • install stack
  • run stack exec multivariant

or you can use cabal install multivariant.

Language description

There are several typeclasses for tagless-final encoding of language: - Program - WithDescription - WithCornerCases - WithInvert

Each typeclass defines some operations that every interpreter has to implement.

There are currently three ``interpreters'' (types that implement corresponding typeclasses): - Cases - Description - Solution

Program

WithDescription

WithInvert

TBA

Examples

task = Inv.map ((+1) :<->: (-1)) `withDescription` "Add one to each list element" `withCornerCases` ([0],[0])
    ~>   (   (sum :<->: (\s -> [s,0])) `withDescription` "Compute sum of elements" `withCornerCases` ([[]],[0])
       <+++> (product :<->: (\p -> [1,p])) `withDescription` "Compute product of elements" `withCornerCases` ([[]],[1])
         )

TBA

More examples are available in the examples directory.

comments powered byDisqus