diff --git a/nix/overlay.nix b/nix/overlay.nix index 4545ef2..457688c 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -16,7 +16,6 @@ let hackage "first-class-families" "0.8.0.1" "0h1rxbc7zsxrlhx5xcl58wjx3qi2wny8wb3sk7c1qnydf4ckcckz"; dump-core = hackage "dump-core" "0.1.3.2" "1mi8p736yn00z549pwnjv4ydwbs8mwg6dla3ly447c027nq8py6g"; monadLib = hackage "monadLib" "3.10" "1v4ynjcb963s3lfw3v71qdzvld1mmz1faf8swhvicma5jbvwchy2"; - type-errors-pretty = pkgs.haskell.lib.doJailbreak super.type-errors-pretty; }; pkgs = import nixpkgs { inherit system; }; diff --git a/package.yaml b/package.yaml index 748dd75..fed00ca 100644 --- a/package.yaml +++ b/package.yaml @@ -29,7 +29,6 @@ dependencies: - unagi-chan >= 0.4.0.0 && < 0.5 - async >= 2.2 && < 3 - type-errors >= 0.2.0.0 -- type-errors-pretty >= 0.0.0.0 && < 0.1 - QuickCheck >= 2.11.3 && < 3 custom-setup: diff --git a/polysemy.cabal b/polysemy.cabal index dd76aae..55370ca 100644 --- a/polysemy.cabal +++ b/polysemy.cabal @@ -120,7 +120,6 @@ library , th-abstraction >=0.3.1.0 && <0.5 , transformers >=0.5.2.0 && <0.6 , type-errors >=0.2.0.0 - , type-errors-pretty >=0.0.0.0 && <0.1 , unagi-chan >=0.4.0.0 && <0.5 if impl(ghc < 8.6) default-extensions: @@ -203,7 +202,6 @@ test-suite polysemy-test , th-abstraction >=0.3.1.0 && <0.5 , transformers >=0.5.2.0 && <0.6 , type-errors >=0.2.0.0 - , type-errors-pretty >=0.0.0.0 && <0.1 , unagi-chan >=0.4.0.0 && <0.5 if impl(ghc < 8.6) default-extensions: @@ -250,7 +248,6 @@ benchmark polysemy-bench , th-abstraction >=0.3.1.0 && <0.5 , transformers >=0.5.2.0 && <0.6 , type-errors >=0.2.0.0 - , type-errors-pretty >=0.0.0.0 && <0.1 , unagi-chan >=0.4.0.0 && <0.5 if impl(ghc < 8.6) default-extensions: diff --git a/src/Polysemy/Internal/CustomErrors.hs b/src/Polysemy/Internal/CustomErrors.hs index 6117fe5..3621a0f 100644 --- a/src/Polysemy/Internal/CustomErrors.hs +++ b/src/Polysemy/Internal/CustomErrors.hs @@ -13,6 +13,8 @@ module Polysemy.Internal.CustomErrors , UnhandledEffect , DefiningModule , DefiningModuleForEffect + , type (<>) + , type (%) ) where import Data.Kind @@ -21,7 +23,6 @@ import GHC.TypeLits (Symbol) import Polysemy.Internal.Kind import Polysemy.Internal.CustomErrors.Redefined import Type.Errors hiding (IfStuck, WhenStuck, UnlessStuck) -import Type.Errors.Pretty (type (<>), type (%)) ------------------------------------------------------------------------------ @@ -36,6 +37,20 @@ type family DefiningModuleForEffect (e :: k) :: Symbol where DefiningModuleForEffect (e a) = DefiningModuleForEffect e DefiningModuleForEffect e = DefiningModule e +-- These are taken from type-errors-pretty because it's not in stackage for 9.0.1 +-- See https://github.com/polysemy-research/polysemy/issues/401 +type family ToErrorMessage (t :: k) :: ErrorMessage where + ToErrorMessage (t :: Symbol) = 'Text t + ToErrorMessage (t :: ErrorMessage) = t + ToErrorMessage t = 'ShowType t + +infixl 5 <> +type family (<>) (l :: k1) (r :: k2) :: ErrorMessage where + l <> r = ToErrorMessage l ':<>: ToErrorMessage r + +infixr 4 % +type family (%) (t :: k1) (b :: k2) :: ErrorMessage where + t % b = ToErrorMessage t ':$$: ToErrorMessage b -- TODO(sandy): Put in type-errors type ShowTypeBracketed t = "(" <> t <> ")" diff --git a/src/Polysemy/Internal/Index.hs b/src/Polysemy/Internal/Index.hs index 9c307dc..f4ebe3c 100644 --- a/src/Polysemy/Internal/Index.hs +++ b/src/Polysemy/Internal/Index.hs @@ -9,8 +9,8 @@ module Polysemy.Internal.Index where import GHC.TypeLits (Nat) import Type.Errors (TypeError, ErrorMessage(ShowType)) -import Type.Errors.Pretty (type (<>), type (%)) +import Polysemy.Internal.CustomErrors (type (<>), type (%)) import Polysemy.Internal.Sing (SList (SEnd, SCons)) ------------------------------------------------------------------------------