Skip to content

Commit

Permalink
Bugfix: Compile on GHC 9.6.2. Resolves tweag#4
Browse files Browse the repository at this point in the history
* is deprecated in favor of Type
Functor is now a prerequisite for Bifunctor
  • Loading branch information
seanhess committed Jul 28, 2023
1 parent 19e0184 commit 4d59ab5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions kernmantle/src/Control/Kernmantle/Rope.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ newtype Rope (record::RopeRec) (mantle::[Strand]) (core::BinEff) a b =
, ThrowEffect ex, TryEffect ex
, SieveTrans f
, HasAutoIdent eff
, Bifunctor, Biapplicative
, Functor, Bifunctor, Biapplicative
)

runRope :: Rope record mantle core a b -> record (Weaver core) mantle -> core a b
Expand Down Expand Up @@ -199,7 +199,7 @@ tighten r = mkRope $ runRope r . fromARec

-- | Turn a 'TightRope' into a 'LooseRope'. This is very often the first step
-- in a chain of 'weave's.
loosen :: (NatToInt (RLength m))
loosen :: (ToARec m, NatToInt (RLength m))
=> TightRope m core :-> LooseRope m core
loosen r = mkRope $ runRope r . toARec
{-# INLINE loosen #-}
Expand Down
12 changes: 8 additions & 4 deletions kernmantle/src/Control/Kernmantle/Rope/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Data.Bifunctor
import Data.Biapplicative
import Data.Bifunctor.Tannen
import Data.Functor.Identity
import Data.Kind (Type)
import Data.Profunctor.Cayley
import Data.Profunctor.EffFunctor
import Data.Profunctor.Monad
Expand All @@ -36,10 +37,10 @@ import Control.Kernmantle.Error

-- | The kind for all binary effects. First param is usually an input
-- (contravariant) of the effect and second one an output (covariant).
type BinEff = * -> * -> *
type BinEff = Type -> Type -> Type

-- | The kind for unary effects
type UnaryEff = * -> *
type UnaryEff = Type -> Type

-- | The kind for a named binary effect. Must remain a tuple because that's what
-- vinyl expects.
Expand All @@ -53,9 +54,9 @@ type family StrandEff t where

-- | The kind for records that will contain 'Weaver's. First type param will
-- most often be @Weaver someCore@
type RopeRec = (Strand -> *) -> [Strand] -> *
type RopeRec = (Strand -> Type) -> [Strand] -> Type

-- | Runs one @strand@ (* -> * -> * effect) in a @interp@ effect. Is
-- | Runs one @strand@ (Type -> Type -> Type effect) in a @interp@ effect. Is
-- parameterized over a Strand (and not just a BinEffect) even if it ignores its
-- name internally because that's what is expect by the 'RopeRec'
newtype Weaver (interp::BinEff) (strand::Strand) = Weaver
Expand Down Expand Up @@ -90,6 +91,9 @@ newtype RopeRunner (record::RopeRec) (mantle::[Strand]) (interp::BinEff) (core::
deriving (EffFunctor, EffPointedFunctor)
via Tannen ((->) (record (Weaver interp) mantle))

instance Functor (core a) => Functor (RopeRunner record mantle interp core a) where
fmap f (RopeRunner run) = RopeRunner $ \record -> fmap f (run record)

instance (RMap m) => EffProfunctor (RopeRunner Rec m) where
effdimap f g (RopeRunner run) = RopeRunner $
g . run . rmap (mapWeaverInterp f)
Expand Down

0 comments on commit 4d59ab5

Please sign in to comment.