mirror of
https://github.com/lexi-lambda/freer-simple.git
synced 2024-12-23 05:51:58 +03:00
Better support GHC 8.8
- Loosen bounds on template-haskell - Remove some unused imports caught by the new import checker - Support NoStarIsType
This commit is contained in:
parent
ec84ae4e23
commit
b2554e5078
18
.travis.yml
18
.travis.yml
@ -10,33 +10,37 @@ cache:
|
|||||||
# cache file per set of arguments.
|
# cache file per set of arguments.
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- env: ARGS="--resolver lts-7"
|
- env: ARGS="--stack-yaml=stack.ghc-8.4.yaml --resolver lts-7"
|
||||||
compiler: ": #stack 8.0.1"
|
compiler: ": #stack 8.0.1"
|
||||||
addons: { apt: { packages: [libgmp-dev] } }
|
addons: { apt: { packages: [libgmp-dev] } }
|
||||||
|
|
||||||
- env: ARGS="--resolver lts-8"
|
- env: ARGS="--stack-yaml=stack.ghc-8.4.yaml --resolver lts-8"
|
||||||
compiler: ": #stack 8.0.2"
|
compiler: ": #stack 8.0.2"
|
||||||
addons: { apt: { packages: [libgmp-dev] } }
|
addons: { apt: { packages: [libgmp-dev] } }
|
||||||
|
|
||||||
- env: ARGS="--resolver lts-10"
|
- env: ARGS="--stack-yaml=stack.ghc-8.4.yaml --resolver lts-10"
|
||||||
compiler: ": #stack 8.2.1"
|
compiler: ": #stack 8.2.1"
|
||||||
addons: { apt: { packages: [libgmp-dev] } }
|
addons: { apt: { packages: [libgmp-dev] } }
|
||||||
|
|
||||||
- env: ARGS="--resolver lts-11"
|
- env: ARGS="--stack-yaml=stack.ghc-8.4.yaml --resolver lts-11"
|
||||||
compiler: ": #stack 8.2.2"
|
compiler: ": #stack 8.2.2"
|
||||||
addons: { apt: { packages: [libgmp-dev] } }
|
addons: { apt: { packages: [libgmp-dev] } }
|
||||||
|
|
||||||
- env: ARGS="--resolver lts-12"
|
- env: ARGS="--stack-yaml=stack.ghc-8.4.yaml --resolver lts-12"
|
||||||
compiler: ": #stack 8.4.4"
|
compiler: ": #stack 8.4.4"
|
||||||
addons: { apt: { packages: [libgmp-dev] } }
|
addons: { apt: { packages: [libgmp-dev] } }
|
||||||
|
|
||||||
- env: ARGS="--resolver nightly"
|
- env: ARGS="--resolver lts-14"
|
||||||
|
compiler: ": #stack 8.6.5"
|
||||||
|
addons: { apt: { packages: [libgmp-dev] } }
|
||||||
|
|
||||||
|
- env: ARGS="--stack-yaml=stack.ghc-8.8.yaml --resolver nightly"
|
||||||
compiler: ": #stack nightly"
|
compiler: ": #stack nightly"
|
||||||
addons: { apt: { packages: [libgmp-dev] } }
|
addons: { apt: { packages: [libgmp-dev] } }
|
||||||
|
|
||||||
allow_failures:
|
allow_failures:
|
||||||
# Nightly builds are allowed to fail
|
# Nightly builds are allowed to fail
|
||||||
- env: ARGS="--resolver nightly"
|
- env: ARGS="--stack-yaml=stack.ghc-8.8.yaml --resolver nightly"
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
# Using compiler above sets CC to an invalid value, so unset it
|
# Using compiler above sets CC to an invalid value, so unset it
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE NoMonomorphismRestriction #-}
|
{-# LANGUAGE NoMonomorphismRestriction #-}
|
||||||
|
|
||||||
module Trace (module Trace) where
|
module Trace (module Trace) where
|
||||||
|
|
||||||
import Control.Applicative ((<$>), (<*>), pure)
|
#if !MIN_VERSION_base(4,11,0)
|
||||||
import Data.Function (($))
|
|
||||||
import Data.Int (Int)
|
|
||||||
import Data.Monoid ((<>))
|
import Data.Monoid ((<>))
|
||||||
import System.IO (IO)
|
#endif
|
||||||
import Text.Show (Show(show))
|
|
||||||
|
|
||||||
import Control.Monad.Freer (Eff, Member)
|
import Control.Monad.Freer (Eff, Member)
|
||||||
import Control.Monad.Freer.Reader (ask, runReader)
|
import Control.Monad.Freer.Reader (ask, runReader)
|
||||||
|
@ -57,7 +57,7 @@ library:
|
|||||||
dependencies:
|
dependencies:
|
||||||
- natural-transformation >= 0.2
|
- natural-transformation >= 0.2
|
||||||
- transformers-base
|
- transformers-base
|
||||||
- template-haskell >= 2.11 && < 2.15
|
- template-haskell >= 2.11 && < 2.16
|
||||||
|
|
||||||
executables:
|
executables:
|
||||||
freer-examples:
|
freer-examples:
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
|
||||||
-- |
|
-- |
|
||||||
-- Module: Control.Monad.Freer.Writer
|
-- Module: Control.Monad.Freer.Writer
|
||||||
-- Description: Composable Writer effects.
|
-- Description: Composable Writer effects.
|
||||||
@ -19,7 +21,10 @@ module Control.Monad.Freer.Writer
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Arrow (second)
|
import Control.Arrow (second)
|
||||||
|
|
||||||
|
#if !MIN_VERSION_base(4,11,0)
|
||||||
import Data.Monoid ((<>))
|
import Data.Monoid ((<>))
|
||||||
|
#endif
|
||||||
|
|
||||||
import Control.Monad.Freer.Internal (Eff, Member, handleRelay, send)
|
import Control.Monad.Freer.Internal (Eff, Member, handleRelay, send)
|
||||||
|
|
||||||
|
@ -32,11 +32,12 @@
|
|||||||
-- substitution for @Typeable@.
|
-- substitution for @Typeable@.
|
||||||
module Data.OpenUnion.Internal where
|
module Data.OpenUnion.Internal where
|
||||||
|
|
||||||
|
import Data.Kind (Type)
|
||||||
import GHC.TypeLits (TypeError, ErrorMessage(..))
|
import GHC.TypeLits (TypeError, ErrorMessage(..))
|
||||||
import Unsafe.Coerce (unsafeCoerce)
|
import Unsafe.Coerce (unsafeCoerce)
|
||||||
|
|
||||||
-- | Open union is a strong sum (existential with an evidence).
|
-- | Open union is a strong sum (existential with an evidence).
|
||||||
data Union (r :: [* -> *]) a where
|
data Union (r :: [Type -> Type]) a where
|
||||||
Union :: {-# UNPACK #-} !Word -> t a -> Union r a
|
Union :: {-# UNPACK #-} !Word -> t a -> Union r a
|
||||||
|
|
||||||
-- | Takes a request of type @t :: * -> *@, and injects it into the 'Union'.
|
-- | Takes a request of type @t :: * -> *@, and injects it into the 'Union'.
|
||||||
@ -76,7 +77,7 @@ newtype P t r = P {unP :: Word}
|
|||||||
-- prior to recursion, and it is used to produce better type errors.
|
-- prior to recursion, and it is used to produce better type errors.
|
||||||
--
|
--
|
||||||
-- This is essentially a compile-time computation without run-time overhead.
|
-- This is essentially a compile-time computation without run-time overhead.
|
||||||
class FindElem (t :: * -> *) (r :: [* -> *]) where
|
class FindElem (t :: Type -> Type) (r :: [Type -> Type]) where
|
||||||
-- | Position of the element @t :: * -> *@ in a type list @r :: [* -> *]@.
|
-- | Position of the element @t :: * -> *@ in a type list @r :: [* -> *]@.
|
||||||
--
|
--
|
||||||
-- Position is computed during compilation, i.e. there is no run-time
|
-- Position is computed during compilation, i.e. there is no run-time
|
||||||
@ -96,7 +97,7 @@ instance {-# OVERLAPPABLE #-} FindElem t r => FindElem t (t' ': r) where
|
|||||||
|
|
||||||
-- | Instance resolution for this class fails with a custom type error
|
-- | Instance resolution for this class fails with a custom type error
|
||||||
-- if @t :: * -> *@ is not in the list @r :: [* -> *]@.
|
-- if @t :: * -> *@ is not in the list @r :: [* -> *]@.
|
||||||
class IfNotFound (t :: * -> *) (r :: [* -> *]) (w :: [* -> *])
|
class IfNotFound (t :: Type -> Type) (r :: [Type -> Type]) (w :: [Type -> Type])
|
||||||
|
|
||||||
-- | If we reach an empty list, that’s a failure, since it means the type isn’t
|
-- | If we reach an empty list, that’s a failure, since it means the type isn’t
|
||||||
-- in the list. For GHC >=8, we can render a custom type error that explicitly
|
-- in the list. For GHC >=8, we can render a custom type error that explicitly
|
||||||
@ -128,7 +129,7 @@ instance {-# INCOHERENT #-} IfNotFound t r w
|
|||||||
-- @
|
-- @
|
||||||
-- 'Member' ('Control.Monad.Freer.State.State' 'Integer') effs => 'Control.Monad.Freer.Eff' effs ()
|
-- 'Member' ('Control.Monad.Freer.State.State' 'Integer') effs => 'Control.Monad.Freer.Eff' effs ()
|
||||||
-- @
|
-- @
|
||||||
class FindElem eff effs => Member (eff :: * -> *) effs where
|
class FindElem eff effs => Member (eff :: Type -> Type) effs where
|
||||||
-- This type class is used for two following purposes:
|
-- This type class is used for two following purposes:
|
||||||
--
|
--
|
||||||
-- * As a @Constraint@ it guarantees that @t :: * -> *@ is a member of a
|
-- * As a @Constraint@ it guarantees that @t :: * -> *@ is a member of a
|
||||||
|
4
stack.ghc-8.4.yaml
Normal file
4
stack.ghc-8.4.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
resolver: lts-12.26
|
||||||
|
packages: [.]
|
||||||
|
extra-deps:
|
||||||
|
- extensible-effects-3.1.0.0
|
3
stack.ghc-8.8.yaml
Normal file
3
stack.ghc-8.8.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
resolver: nightly-2019-10-04
|
||||||
|
packages: [.]
|
||||||
|
extra-deps: []
|
12
stack.yaml
12
stack.yaml
@ -1,10 +1,4 @@
|
|||||||
resolver: lts-12.18
|
resolver: lts-14.7
|
||||||
|
packages: [.]
|
||||||
packages:
|
|
||||||
- '.'
|
|
||||||
|
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- extensible-effects-3.1.0.0
|
- extensible-effects-5.0.0.1@sha256:2ed0bee04c8bf334358147da6d92ff31e9fbbefceb75ef3e408a0d858aec0cc6,9013
|
||||||
|
|
||||||
flags: {}
|
|
||||||
extra-package-dbs: []
|
|
||||||
|
19
stack.yaml.lock
Normal file
19
stack.yaml.lock
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# This file was autogenerated by Stack.
|
||||||
|
# You should not edit this file by hand.
|
||||||
|
# For more information, please see the documentation at:
|
||||||
|
# https://docs.haskellstack.org/en/stable/lock_files
|
||||||
|
|
||||||
|
packages:
|
||||||
|
- completed:
|
||||||
|
hackage: extensible-effects-5.0.0.1@sha256:2ed0bee04c8bf334358147da6d92ff31e9fbbefceb75ef3e408a0d858aec0cc6,9013
|
||||||
|
pantry-tree:
|
||||||
|
size: 3306
|
||||||
|
sha256: 4c520f1ccb76ed1d304cb5967e6679e31c907d3c0ba5d7e4a459e827b9a08173
|
||||||
|
original:
|
||||||
|
hackage: extensible-effects-5.0.0.1@sha256:2ed0bee04c8bf334358147da6d92ff31e9fbbefceb75ef3e408a0d858aec0cc6,9013
|
||||||
|
snapshots:
|
||||||
|
- completed:
|
||||||
|
size: 523700
|
||||||
|
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/7.yaml
|
||||||
|
sha256: 8e3f3c894be74d71fa4bf085e0a8baae7e4d7622d07ea31a52736b80f8b9bb1a
|
||||||
|
original: lts-14.7
|
Loading…
Reference in New Issue
Block a user