free-alacarte 0.1.0.4 → 1.0.0.2
raw patch · 2 files changed
+14/−16 lines, 2 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- free-alacarte.cabal +2/−2
- src/Free/AlaCarte.hs +12/−14
free-alacarte.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: free-alacarte-version: 0.1.0.4+version: 1.0.0.2 maintainer: Josep Bigorra <jjbigorra@gmail.com> build-type: Simple license: GPL-3@@ -52,6 +52,6 @@ ViewPatterns ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wpartial-fields -Wredundant-constraints build-depends:- base < 4.19.0.0+ base < 5 default-language: GHC2021
src/Free/AlaCarte.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE LambdaCase #-}-{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}-{-# OPTIONS_GHC -fno-warn-missing-export-lists #-} {-# OPTIONS_GHC -fno-warn-all-missed-specialisations #-}+{-# OPTIONS_GHC -fno-warn-missing-export-lists #-}+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-} -- Inspired on Data types a la carte @@ -20,31 +20,31 @@ prj :: sup a -> Maybe (sub a) instance (Functor f) => f :<: f where- {-# INLINABLE inj #-}+ {-# INLINEABLE inj #-} inj :: f a -> f a inj = id - {-# INLINABLE prj #-}+ {-# INLINEABLE prj #-} prj :: f a -> Maybe (f a) prj = Just instance (Functor f, Functor g) => f :<: (f :+: g) where- {-# INLINABLE inj #-}+ {-# INLINEABLE inj #-} inj :: f a -> (f :+: g) a inj = Left' - {-# INLINABLE prj #-}+ {-# INLINEABLE prj #-} prj :: (f :+: g) a -> Maybe (f a) prj = \case Left' e -> Just e Right' _e -> Nothing instance {-# OVERLAPPABLE #-} (Functor f, Functor g, f :<: g, Functor h) => f :<: (h :+: g) where- {-# INLINABLE inj #-}+ {-# INLINEABLE inj #-} inj :: f a -> (h :+: g) a inj = Right' . inj - {-# INLINABLE prj #-}+ {-# INLINEABLE prj #-} prj :: (h :+: g) a -> Maybe (f a) prj = \case Left' _e -> Nothing@@ -57,17 +57,17 @@ deriving (Functor) instance (Functor f) => Applicative (Free f) where- {-# INLINABLE pure #-}+ {-# INLINEABLE pure #-} pure :: a -> Free f a pure = Pure - {-# INLINABLE (<*>) #-}+ {-# INLINEABLE (<*>) #-} (<*>) :: Free f (a -> b) -> Free f a -> Free f b Pure f <*> t = fmap f t Impure f <*> t = Impure (fmap (<*> t) f) instance (Functor f) => Monad (Free f) where- {-# INLINABLE (>>=) #-}+ {-# INLINEABLE (>>=) #-} (>>=) :: Free f a -> (a -> Free f b) -> Free f b Pure x >>= f = f x Impure t >>= f = Impure (fmap (>>= f) t)@@ -90,7 +90,7 @@ exec = foldFree return execAlgebra instance (Exec f, Exec g) => Exec (f :+: g) where- {-# INLINABLE execAlgebra #-}+ {-# INLINEABLE execAlgebra #-} execAlgebra = \case Left' e -> execAlgebra e Right' e -> execAlgebra e@@ -101,5 +101,3 @@ injectFree :: (g :<: f) => g (Free f a) -> Free f a injectFree = Impure . inj--