-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Type Level Specification by Example -- -- Please see README.md @package type-spec @version 0.1.0.0 -- | Type Equality module Test.TypeSpec.Internal.Equality -- | Operator 'Data.Equality.(==)' expects both arguments to have the same -- kind. -- | Useful abstractions for type level programming using. This -- reimplements parts of the singletons library, which is just too heavy -- of a dependency to carry around, when only three small types are used -- of it. module Test.TypeSpec.Internal.Apply -- | Bind to actions. -- | Execute one action and then the next, ignore the result of the first. type (>>) ma mb = ma >>= Const' mb -- | Execute an action that returns a function than map function over the -- result of the next action. -- | Execute an action and map a pure function over the result. data (<$>$$) :: (a ~> b) ~> (m a ~> m b) data (<$>$) :: (a ~> b) -> m a ~> m b -- | Convert data types to Partially applicable type functions data TyCon1 :: (a -> b) -> a ~> b data TyCon2 :: (a -> b -> c) -> a ~> (b ~> c) data TyFun :: Type -> Type -> Type type TyFunData a b = TyFun a b -> Type type (~>) a b = TyFun a b -> Type -- | List construction data Cons'' :: a ~> ([a] ~> [a]) data Cons' :: a -> [a] ~> [a] -- | Tuple construction data Pair'' :: a ~> (b ~> (a, b)) data Pair' :: a -> b ~> (a, b) data Const' :: a -> (TyFunData b a) data Const'' :: TyFunData a (TyFunData b a) data Flip' :: (a ~> (b ~> c)) ~> (b ~> (a ~> c)) data Flip :: (a ~> (b ~> c)) -> b ~> (a ~> c) data Flip_ :: (a ~> (b ~> c)) -> b -> a ~> c data Compose'' :: (b ~> c) ~> ((a ~> b) ~> (a ~> c)) data Compose' :: (b ~> c) -> (a ~> b) ~> (a ~> c) data Compose :: (b ~> c) -> (a ~> b) -> (a ~> c) -- | Useful abstractions for type level programming using Either. module Test.TypeSpec.Internal.Either -- | Result type used in constraints inside TypeSpec to propagate -- type errors. module Test.TypeSpec.Internal.Result -- | When a type level expectation is tested, it might be that compound -- expectations fail. In order to have a small, precise error message, -- the type level assertion results are made to have kind Result. type Result = Either ErrorMessage type FAILED = Left -- | A nice name than Left type OK = Right -- | Core of the TypeSpec abstractions. Import to add custom instances. module Test.TypeSpec.Core -- | A type specification. data TypeSpec expectation -- | Expect the given expectations to hold. If the compiler does not reject -- it - the expectation seem plausible. [Valid] :: (Try (EvalExpectation expectation) ~ expectation) => TypeSpec expectation -- | Expect the given expectations to **NOT** hold. If the compiler does -- not reject it - the expectation seem indeed implausible. [Invalid] :: (DontTry (EvalExpectation expectation)) => TypeSpec expectation -- | An open family of type level expectation evaluators, that return -- either () or an ErrorMessage. -- | A class for pretty printing via the Show instance of -- TypeSpec. class PrettyTypeSpec (t :: k) prettyTypeSpec :: PrettyTypeSpec t => proxy t -> Doc -- | The default indention to use when nesting Documents. prettyIndentation :: Int -- | Nest using the default indention prettyIndentation. nest' :: Doc -> Doc -- | Print a sentence with the second part hanging from the -- first. Generate: predicate: object sentence :: String -> Doc -> Doc instance forall k (t :: k). Test.TypeSpec.Core.PrettyTypeSpec t => GHC.Show.Show (Test.TypeSpec.Core.TypeSpec t) instance forall k k1 (expectation1 :: k) (expectation2 :: k1). (Test.TypeSpec.Core.PrettyTypeSpec expectation1, Test.TypeSpec.Core.PrettyTypeSpec expectation2) => Test.TypeSpec.Core.PrettyTypeSpec '(expectation1, expectation2) instance Test.TypeSpec.Core.PrettyTypeSpec '[] instance forall a (expectation :: a) (rest :: [a]). (Test.TypeSpec.Core.PrettyTypeSpec expectation, Test.TypeSpec.Core.PrettyTypeSpec rest) => Test.TypeSpec.Core.PrettyTypeSpec (expectation : rest) -- | Group expectations module Test.TypeSpec.Group -- | A cons like operator. Make a list of expectations. Use this -- to chain together any expectations especially those using '(~~~)' or -- '(-*)', since it has a lower precedence than both. data (-/-) expectation1 expectation2 -- | A cons like operator. Make a list of expectations. Use this -- to chain together anything below or inside '(-/-)' and '(~~~)' -- parts. The precedence of this operator is higher that that of '(-/-)'. type (-*) expectation1 expectation2 = expectation1 -/- expectation2 instance forall k k1 (expectation1 :: k) (expectation2 :: k1). (Test.TypeSpec.Core.PrettyTypeSpec expectation1, Test.TypeSpec.Core.PrettyTypeSpec expectation2) => Test.TypeSpec.Core.PrettyTypeSpec (expectation1 Test.TypeSpec.Group.-/- expectation2) -- | Label expectations module Test.TypeSpec.Label -- | Add a type level string as label or longer descripton around -- expectations. This is analog to the it function in the -- hspec package. data It :: Symbol -> expectation -> Type instance forall expectation (msg :: GHC.Types.Symbol) (x :: expectation). (GHC.TypeLits.KnownSymbol msg, Test.TypeSpec.Core.PrettyTypeSpec x) => Test.TypeSpec.Core.PrettyTypeSpec (Test.TypeSpec.Label.It msg x) -- | Type level assertions on type equality. module Test.TypeSpec.ShouldBe -- | State that two types or type constructs are boiled down to the same -- type. data ShouldBe :: expected -> actual -> Type -- | State that two types or type constructs are NOT the same type. data ShouldNotBe :: expected -> actual -> Type -- | State that a type is equal to the type level True. data ShouldBeTrue :: expectation -> Type -- | State that a type is equal to the type level False. data ShouldBeFalse :: expectation -> Type -- | State that one type is different to two other types. This must always -- be used right next to a ShouldBe pair, otherwise this will not -- work. data ButNot :: shouldBe -> actual -> Type instance forall expectation (a :: expectation). Test.TypeSpec.Core.PrettyTypeSpec (Test.TypeSpec.ShouldBe.ShouldBeTrue a) instance forall expectation (a :: expectation). Test.TypeSpec.Core.PrettyTypeSpec (Test.TypeSpec.ShouldBe.ShouldBeFalse a) instance forall expected actual (a :: expected) (b :: actual). Test.TypeSpec.Core.PrettyTypeSpec (Test.TypeSpec.ShouldBe.ShouldBe a b) instance forall expected actual (a :: expected) (b :: actual). (Type.Showtype.Showtype a, Type.Showtype.Showtype b) => Test.TypeSpec.Core.PrettyTypeSpec (Test.TypeSpec.ShouldBe.ShouldNotBe a b) instance forall k k1 actual a (a0 :: k) (a1 :: k1) (b :: actual). (a ~ Test.TypeSpec.ShouldBe.ShouldBe a0 a1, Type.Showtype.Showtype a0, Type.Showtype.Showtype a1, Type.Showtype.Showtype b) => Test.TypeSpec.Core.PrettyTypeSpec (Test.TypeSpec.ShouldBe.ButNot a b) -- | A tiny EDSL to write type-level-unit tests. module Test.TypeSpec -- | An alias for TypeSpec. type Expect = TypeSpec -- | Another alias for TypeSpec (and also It) type Explain does this = TypeSpec (It does this) type It's = It type IsTheSameAs = ShouldBe type Is = ShouldBe type TheseAreEqual = ShouldBe type IsNot = ShouldNotBe type Isn't = ShouldNotBe type IsNotTheSameAs = ShouldNotBe type IsDifferentFrom = ShouldNotBe type TheseAreNotEqual = ShouldNotBe type IsTrue = ShouldBeTrue type Therefore = ShouldBeTrue type And = ShouldBeTrue type IsFalse = ShouldBeFalse type They message expectations = It message expectations type Describe = It type Context = It -- | Funny operators that are mere type aliases for the constructs in -- TypeSpec module Test.TypeSpecCrazy -- | Create a TypeSpec with an initial description or title followed -- by some expectations. Note that the number of #s is alway a -- multiple of 3. type (###) title expr = Explain title expr type (######) title expr = Explain title expr type (#########) title expr = Explain title expr type (############) title expr = Explain title expr type (###############) title expr = Explain title expr type (##################) title expr = Explain title expr type (#####################) title expr = Explain title expr type (########################) title expr = Explain title expr type (###########################) title expr = Explain title expr type (##############################) title expr = Explain title expr type (#################################) title expr = Explain title expr type (####################################) title expr = Explain title expr type (#######################################) title expr = Explain title expr type (##########################################) title expr = Explain title expr type (#############################################) title expr = Explain title expr type (################################################) title expr = Explain title expr type (###################################################) title expr = Explain title expr type (######################################################) title expr = Explain title expr type (#########################################################) title expr = Explain title expr type (############################################################) title expr = Explain title expr type (###############################################################) title expr = Explain title expr type (##################################################################) title expr = Explain title expr type (#####################################################################) title expr = Explain title expr type (########################################################################) title expr = Explain title expr -- | Specify an expectation using an underlined title using It. type (--*) title expr = It title expr type (~~~) title expr = It title expr type (~~~~~~) title expr = It title expr type (~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) title expr = It title expr type (-*-) expectation1 expectation2 = expectation1 -/- expectation2