type-spec 0.3.0.0 → 0.3.0.1
raw patch · 6 files changed
+19/−19 lines, 6 files
Files
- README.md +7/−7
- examples/Main.hs +1/−1
- src/Test/TypeSpec/Core.hs +2/−2
- src/Test/TypeSpec/Group.hs +1/−1
- src/Test/TypeSpec/ShouldBe.hs +7/−7
- type-spec.cabal +1/−1
README.md view
@@ -14,14 +14,14 @@ main :: IO () main = print spec0 - spec :: Expect (Int `Isn't` Bool)+ spec :: Expect "Expect something..." (Int `Isn't` Bool) spec = Valid This will output: Valid:- • Type: Int- differs from: Bool+ Expect something...+ (✓ Different) Using the operators from _TypeSpecCrazy_: @@ -72,11 +72,11 @@ There are a variety aliases for the basic combinators. Basic Combinators Context- Labels expectations using 'It'+ labels expectations using 'It' Describe- is an alias for It, just like They- is time for the first assertion- • Types are equal+ an alias for It, just like They+ time for the first assertion+ (✓ Equal) The key feature is that the compiler checks the assertions and expectations made in a 'TypeSpec' and right away rejects invalid types.
examples/Main.hs view
@@ -19,7 +19,7 @@ -- * TypeSpec Examples -- | Let's start off simple:-specHelloWorld :: Expect (Int `Isn't` Bool)+specHelloWorld :: Explain "Expect something..." (Int `Isn't` Bool) specHelloWorld = Valid -- | We can also expect a bit more using lists and tuples:
src/Test/TypeSpec/Core.hs view
@@ -67,7 +67,7 @@ => PrettyTypeSpec '(expectation1, expectation2) where prettyTypeSpec _ =- prettyTypeSpec pe1 $$ prettyTypeSpec pe2+ prettyTypeSpec pe1 <+> prettyTypeSpec pe2 where pe1 = Proxy :: Proxy expectation1 pe2 = Proxy :: Proxy expectation2 @@ -82,6 +82,6 @@ => PrettyTypeSpec (expectation ': rest) where prettyTypeSpec _ =- (prettyTypeSpec pe1) $$ (prettyTypeSpec pe2)+ (prettyTypeSpec pe1) <+> (prettyTypeSpec pe2) where pe1 = Proxy :: Proxy expectation pe2 = Proxy :: Proxy rest
src/Test/TypeSpec/Group.hs view
@@ -33,6 +33,6 @@ => PrettyTypeSpec (expectation1 -/- expectation2) where prettyTypeSpec _ =- prettyTypeSpec pe1 $$ prettyTypeSpec pe2+ prettyTypeSpec pe1 $+$ prettyTypeSpec pe2 where pe1 = Proxy :: Proxy expectation1 pe2 = Proxy :: Proxy expectation2
src/Test/TypeSpec/ShouldBe.hs view
@@ -79,26 +79,26 @@ instance PrettyTypeSpec (ShouldBeTrue a) where prettyTypeSpec _px =- prettyBulletPoint "ShouldBeTrue a"+ prettyCheck "True" instance PrettyTypeSpec (ShouldBeFalse a) where prettyTypeSpec _px =- prettyBulletPoint "ShouldBeFalse a"+ prettyCheck "False" instance PrettyTypeSpec (ShouldBe a b) where prettyTypeSpec _px =- prettyBulletPoint "a `ShouldBe` b"+ prettyCheck "Equal" instance PrettyTypeSpec (ShouldNotBe a b) where prettyTypeSpec _px =- prettyBulletPoint "a `ShouldNotBe` b"+ prettyCheck "Different" instance (a ~ (ShouldBe a0 a1)) => PrettyTypeSpec (ButNot a b) where prettyTypeSpec _ =- prettyBulletPoint "a 'ShouldBe' b 'ButNot' c"+ prettyCheck "Restricted" -- | Pretty print a test prefix by a bullet-point.-prettyBulletPoint :: String -> Doc-prettyBulletPoint doc = text "•" <+> text doc+prettyCheck :: String -> Doc+prettyCheck doc = parens (text "✓" <+> text doc)
type-spec.cabal view
@@ -1,5 +1,5 @@ name: type-spec-version: 0.3.0.0+version: 0.3.0.1 synopsis: Type Level Specification by Example description: Please see README.md homepage: https://github.com/sheyll/type-spec#readme