packages feed

type-spec 0.2.0.0 → 0.3.0.0

raw patch · 6 files changed

+28/−125 lines, 6 filesdep −show-typePVP ok

version bump matches the API change (PVP)

Dependencies removed: show-type

API changes (from Hackage documentation)

- Test.TypeSpec.Core: nest' :: Doc -> Doc
- Test.TypeSpec.Core: sentence :: String -> Doc -> Doc
- Test.TypeSpec.ShouldBe: 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)
- Test.TypeSpec.ShouldBe: instance forall expected actual (a :: expected) (b :: actual). Test.TypeSpec.Core.PrettyTypeSpec (Test.TypeSpec.ShouldBe.ShouldBe a b)
- Test.TypeSpec.ShouldBe: 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)
+ Test.TypeSpec.ShouldBe: instance forall actual expected (a :: actual) (b :: expected). Test.TypeSpec.Core.PrettyTypeSpec (Test.TypeSpec.ShouldBe.ShouldBe a b)
+ Test.TypeSpec.ShouldBe: instance forall actual expected (a :: actual) (b :: expected). Test.TypeSpec.Core.PrettyTypeSpec (Test.TypeSpec.ShouldBe.ShouldNotBe a b)
+ Test.TypeSpec.ShouldBe: instance forall actual expected shouldntBe a (a0 :: actual) (a1 :: expected) (b :: shouldntBe). a ~ Test.TypeSpec.ShouldBe.ShouldBe a0 a1 => Test.TypeSpec.Core.PrettyTypeSpec (Test.TypeSpec.ShouldBe.ButNot a b)
- Test.TypeSpec.ShouldBe: data ButNot :: shouldBe -> actual -> Type
+ Test.TypeSpec.ShouldBe: data ButNot :: shouldBe -> shouldntBe -> Type
- Test.TypeSpec.ShouldBe: data ShouldBe :: expected -> actual -> Type
+ Test.TypeSpec.ShouldBe: data ShouldBe :: actual -> expected -> Type
- Test.TypeSpec.ShouldBe: data ShouldNotBe :: expected -> actual -> Type
+ Test.TypeSpec.ShouldBe: data ShouldNotBe :: actual -> expected -> Type

Files

src/Test/TypeSpec/Core.hs view
@@ -8,8 +8,6 @@   -- * Pretty Printing Support   , PrettyTypeSpec(..)   , prettyIndentation-  , nest'-  , sentence   , module ReExport   )   where@@ -20,8 +18,6 @@ import Test.TypeSpec.Internal.Result as ReExport import Text.PrettyPrint -- -- | A type specification. data TypeSpec expectation  where   -- | Expect the given expectations to hold. If the compiler does not reject it -@@ -37,8 +33,6 @@ -- or an @ErrorMessage@. type family EvalExpectation (expectation :: k) :: Result k --- ** Combining/Grouping collections- -- | Given a pair @(expectation1, expectation2)@ try to evaluate the first then, -- if no error was returned, the second. type instance EvalExpectation '(a, b) =@@ -67,25 +61,13 @@ prettyIndentation :: Int prettyIndentation = 2 --- | Nest using the default indention `prettyIndentation`.-nest' :: Doc -> Doc-nest' = nest prettyIndentation---- | Print a /sentence/ with the second part 'hang'ing from the first.--- Generate: @predicate: object@-sentence :: String -> Doc -> Doc-sentence predicate object =-  hang (text predicate <> colon <> space) 5 object---- * Default instances- instance     ( PrettyTypeSpec expectation1     , PrettyTypeSpec expectation2 )   => PrettyTypeSpec '(expectation1, expectation2)   where     prettyTypeSpec _ =-        prettyTypeSpec pe1 $+$ prettyTypeSpec pe2+        prettyTypeSpec pe1 $$ prettyTypeSpec pe2       where pe1 = Proxy :: Proxy expectation1             pe2 = Proxy :: Proxy expectation2 @@ -100,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/Label.hs view
@@ -26,4 +26,4 @@ instance (KnownSymbol msg, PrettyTypeSpec x) => PrettyTypeSpec (It msg x) where   prettyTypeSpec _ =     (text (symbolVal (Proxy :: Proxy msg)))-    $+$ nest prettyIndentation (prettyTypeSpec (Proxy :: Proxy x))+    $$ nest prettyIndentation (prettyTypeSpec (Proxy :: Proxy x))
src/Test/TypeSpec/ShouldBe.hs view
@@ -10,15 +10,12 @@  import Data.Kind import Data.Type.Bool--import Data.Typeable import GHC.TypeLits import Test.TypeSpec.Core import Test.TypeSpec.Internal.Apply () import Test.TypeSpec.Internal.Either () import Test.TypeSpec.Internal.Equality import Text.PrettyPrint-import Type.Showtype  -- | State that a type is equal to the type level @True@. data ShouldBeTrue :: expectation -> Type@@ -40,82 +37,68 @@  -- | 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+data ButNot :: shouldBe -> shouldntBe -> Type  type instance-  EvalExpectation (ButNot (ShouldBe expected actual) other) =-    If (EqExtra expected actual)-      (If (EqExtra expected other)+  EvalExpectation (ButNot (ShouldBe actual expected) other) =+    If (EqExtra actual expected)+      (If (EqExtra other expected)           (FAILED             ('Text "Expected type: "              ':$$: 'Text "   " ':<>: 'ShowType expected              ':$$: 'Text "to be different from: "              ':$$: 'Text "   " ':<>: 'ShowType other))-          (OK (ButNot (ShouldBe expected actual) other)))+          (OK (ButNot (ShouldBe actual expected) other)))       (FAILED         ('Text "Expected type: " ':<>: 'ShowType expected          ':$$: 'Text "Actual type:   " ':<>: 'ShowType actual))  -- | State that two types or type constructs are boiled down to the same type.-data ShouldBe :: expected -> actual -> Type+data ShouldBe :: actual -> expected -> Type  type instance-  EvalExpectation (ShouldBe expected actual) =-    If (EqExtra expected actual)-        (OK (ShouldBe expected actual))+  EvalExpectation (ShouldBe actual expected) =+    If (EqExtra actual expected)+        (OK (ShouldBe actual expected))         (FAILED           ('Text "Expected type: " ':<>: 'ShowType expected            ':$$: 'Text "Actual type:   " ':<>: 'ShowType actual))  -- | State that two types or type constructs are NOT the same type.-data ShouldNotBe :: expected -> actual -> Type+data ShouldNotBe :: actual -> expected -> Type  type instance-  EvalExpectation (ShouldNotBe expected actual) =+  EvalExpectation (ShouldNotBe actual expected) =     If (EqExtra expected actual)         (FAILED           ('Text "Expected type: "            ':$$: 'Text "   " ':<>: 'ShowType expected            ':$$: 'Text "to be different from: "            ':$$: 'Text "   " ':<>: 'ShowType actual))-        (OK (ShouldNotBe expected actual))+        (OK (ShouldNotBe actual expected))  instance PrettyTypeSpec (ShouldBeTrue a) where   prettyTypeSpec _px =-    prettyBulletPoint $ text "Type == True"+    prettyBulletPoint "ShouldBeTrue a"  instance PrettyTypeSpec (ShouldBeFalse a) where   prettyTypeSpec _px =-    prettyBulletPoint $ text "Type == False"+    prettyBulletPoint "ShouldBeFalse a"  instance PrettyTypeSpec (ShouldBe a b) where   prettyTypeSpec _px =-    prettyBulletPoint $ text "Types are equal"+    prettyBulletPoint "a `ShouldBe` b" -instance (Showtype a, Showtype b) => PrettyTypeSpec (ShouldNotBe a b) where+instance PrettyTypeSpec (ShouldNotBe a b) where   prettyTypeSpec _px =-      prettyBulletPoint-        $ sentence "Type"  (text expected)-        $$ sentence "differs from" (text actual)-    where-      expected = showtype (Proxy :: Proxy a)-      actual = showtype (Proxy :: Proxy b)+      prettyBulletPoint "a `ShouldNotBe` b"  instance-    (a ~ (ShouldBe a0 a1)-    , Showtype a0-    , Showtype a1-    , Showtype b )+    (a ~ (ShouldBe a0 a1))   => PrettyTypeSpec (ButNot a b) where     prettyTypeSpec _ =-      prettyBulletPoint-        $ (sentence "Type"-                 (text (showtype (Proxy :: Proxy a0))))-        $$ (sentence "is equal to"-                 (text (showtype (Proxy :: Proxy a1))))-        $$ (sentence "but not to"-                 (text (showtype (Proxy :: Proxy b))))+      prettyBulletPoint  "a 'ShouldBe' b 'ButNot' c"  -- | Pretty print a test prefix by a bullet-point.-prettyBulletPoint :: Doc -> Doc-prettyBulletPoint doc = text "•" <+> doc+prettyBulletPoint :: String -> Doc+prettyBulletPoint doc = text "•" <+> text doc
stack.yaml view
@@ -1,67 +1,6 @@-# This file was automatically generated by 'stack init'-#-# Some commonly used options have been documented as comments in this file.-# For advanced use and comprehensive documentation of the format, please see:-# http://docs.haskellstack.org/en/stable/yaml_configuration/--# Resolver to choose a 'specific' stackage snapshot or a compiler version.-# A snapshot resolver dictates the compiler version and the set of packages-# to be used for project dependencies. For example:-#-# resolver: lts-3.5-# resolver: nightly-2015-09-21-# resolver: ghc-7.10.2-# resolver: ghcjs-0.1.0_ghc-7.10.2-# resolver:-#  name: custom-snapshot-#  location: "./custom-snapshot.yaml"-resolver: nightly-2016-07-30--# User packages to be built.-# Various formats can be used as shown in the example below.-#-# packages:-# - some-directory-# - https://example.com/foo/bar/baz-0.0.2.tar.gz-# - location:-#    git: https://github.com/commercialhaskell/stack.git-#    commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a-# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a-#   extra-dep: true-#  subdirs:-#  - auto-update-#  - wai-#-# A package marked 'extra-dep: true' will only be built if demanded by a-# non-dependency (i.e. a user package), and its expr suites and benchmarks-# will not be run. This is useful for tweaking upstream packages.+resolver: lts-7.0 packages: - '.'-# Dependency packages to be pulled from upstream that are not in the resolver-# (e.g., acme-missiles-0.3)-extra-deps:-  - show-type-0.1.1--# Override default flag values for local packages and extra-deps+extra-deps: [] flags: {}--# Extra package databases containing global packages extra-package-dbs: []--# Control whether we use the GHC we find on the path-# system-ghc: true-#-# Require a specific version of stack, using version ranges-# require-stack-version: -any # Default-# require-stack-version: ">=1.1"-#-# Override the architecture used by stack, especially useful on Windows-# arch: i386-# arch: x86_64-#-# Extra directories used by stack for building-# extra-include-dirs: [/path/to/dir]-# extra-lib-dirs: [/path/to/dir]-#-# Allow a newer minor version of GHC than the snapshot specifies-# compiler-check: newer-minor
type-spec.cabal view
@@ -1,5 +1,5 @@ name:                 type-spec-version:              0.2.0.0+version:              0.3.0.0 synopsis:             Type Level Specification by Example description:          Please see README.md homepage:             https://github.com/sheyll/type-spec#readme@@ -30,7 +30,6 @@                      , Test.TypeSpec.Internal.Result   build-depends:       base >= 4.9 && < 5                      , pretty >= 1.1.3 && < 1.2-                     , show-type >= 0.1.1   default-language:    Haskell2010   default-extensions:  ConstraintKinds                      , CPP