The multivariant package

[Tags:bsd3, library, program, test]

Please see README.md


[Skip to Readme]

Properties

Versions 0.1.0.1
Dependencies base (>=4.7 && <5), containers (>=0.5.7.1 && <0.6), free (>=4.12.4 && <4.13), HUnit (>=1.3.1.2 && <1.4), invertible (>=0.1.2 && <0.2), MonadRandom (>=0.4.2.3 && <0.5), multivariant (>=0.1.0.1 && <0.2), profunctors (==5.2.*), QuickCheck (>=2.8.2 && <2.9), semigroupoids (==5.1.*), tasty (>=0.11.0.4 && <0.12), tasty-hunit (>=0.9.2 && <0.10), tasty-quickcheck (>=0.8.4 && <0.9), text (>=1.2.2.1 && <1.3), transformers (>=0.5.2.0 && <0.6) [details]
License BSD3
Copyright Copyright (c) 2016-2017 Anton Marchenko, Mansur Ziatdinov
Author Anton Marchenko, Mansur Ziatdinov
Maintainer gltronred@gmail.com
Category Test
Home page https://bitbucket.org/gltronred/multivariant#readme
Uploaded Tue Jan 31 13:12:46 UTC 2017 by MZiatdinov
Distributions NixOS:0.1.0.1
Downloads 32 total (7 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2017-01-31 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for multivariant

Readme for multivariant-0.1.0.1

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.