type-spec-0.4.0.0: Type Level Specification by Example
Copyright(c) Sven Heyll 2016
LicenseBSD-3
Maintainer[email protected]
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Test.TypeSpec

Description

A tiny EDSL to write type-level-unit tests.

A simple example:

specHelloWorld :: Expect (Int `Isn't` Bool)
specHelloWorld = Valid

We can also expect a bit more using lists and tuples:

specGrouped
  :: Expect '[ Int  `Isn't` Bool
             , Int  `Is`    Int
             , Bool `Is`    Bool  `ButNot`  String
             ]
specGrouped = Valid

The expectations are executed by the compiler when solving the constraints of TypeSpecs constructors.

A TypeSpec also has a Show instance, which can be used in real unit tests to print the expectations.

This module contains mainly re-exports of.

Synopsis

TypeSpec Aliases

type Expect = TypeSpec :: k -> Type Source #

type Explain (does :: Symbol) (this :: expectation) = TypeSpec (It does this) Source #

ShouldBe aliases

type Is = ShouldBe :: actual -> expected -> Type Source #

type IsTheSameAs = ShouldBe :: actual -> expected -> Type Source #

type TheseAreEqual = ShouldBe :: actual -> expected -> Type Source #

ShouldNotBe aliases

type IsNot = ShouldNotBe :: actual -> expected -> Type Source #

type Isn't = ShouldNotBe :: actual -> expected -> Type Source #

type IsNotTheSameAs = ShouldNotBe :: actual -> expected -> Type Source #

type IsDifferentFrom = ShouldNotBe :: actual -> expected -> Type Source #

type TheseAreNotEqual = ShouldNotBe :: actual -> expected -> Type Source #

ShouldBeTrue aliases

type IsTrue = ShouldBeTrue :: expectation -> Type Source #

type And = ShouldBeTrue :: expectation -> Type Source #

type Therefore = ShouldBeTrue :: expectation -> Type Source #

type That = ShouldBeTrue :: expectation -> Type Source #

ShouldBeFalse aliases

type IsFalse = ShouldBeFalse :: expectation -> Type Source #

type Not = ShouldBeTrue :: expectation -> Type Source #

Labelling Aliases

type They (message :: Symbol) (expectations :: expectation) = It message expectations Source #

type Describe = It :: Symbol -> expectation -> Type Source #

type Context = It :: Symbol -> expectation -> Type Source #

type It's = It :: Symbol -> expectation -> Type Source #

Reexports