Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mrm.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ category: Data
build-type: Simple
extra-source-files: README.md
cabal-version: >=1.10
tested-with: GHC==8.0.2, GHC==7.10.3, GHC==7.8.4

source-repository head
type: git
location: https://github.com/scmu/mrm

library
hs-source-dirs: src
build-depends: base >=4.7 && <4.8
build-depends: base >=4.7 && <5.0
other-extensions: GADTs
exposed-modules: Data.Match,
Data.ConstrainedList,
Expand Down
4 changes: 4 additions & 0 deletions src/Data/Match/Effects.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ transFree = Free ^<< transAlgWith (subSub srep) <<^ getFix
transFreeSym :: (fs <: gs) => Algebras (Pure a ': fs) (Free gs a)
transFreeSym = Free ^<< transAlgWith (SCons Here (subSub srep)) <<^ getFix

instance (fs <: fs) => Functor (Free fs) where
fmap f = fold ((\(Pure x) -> Free (inn (Pure (f x)))) ::: transFree) . getFix

instance (fs <: fs) => Monad (Free fs) where
return = Free . inn . Pure
(Free p) >>= f = fold ((\(Pure x) -> f x) :::
transFree) p

instance (Monad (Free fs), Functor (Free fs)) => Applicative (Free fs) where
pure = return
(<*>) = ap
Expand Down
14 changes: 11 additions & 3 deletions src/Data/Match/Membership.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{-# LANGUAGE
GADTs
CPP
, GADTs
, KindSignatures
, DataKinds
, TypeOperators
, MultiParamTypeClasses
, FlexibleInstances
, OverlappingInstances
#-}

#if __GLASGOW_HASKELL__ < 710
{-# LANGUAGE OverlappingInstances #-}
#endif

module Data.Match.Membership
( Elem(..)
, Mem(witness)
Expand All @@ -24,5 +28,9 @@ class Mem f fs where
instance Mem f (f ': fs) where
witness = Here

instance (Mem f fs) => Mem f (g ': fs) where
instance
#if __GLASGOW_HASKELL__ >= 710
{-# OVERLAPPABLE #-}
#endif
(Mem f fs) => Mem f (g ': fs) where
witness = There witness
2 changes: 1 addition & 1 deletion src/Data/Match/Monadic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Data.Match.Monadic where

import Data.Match (Algebras, Match(..), fold, transAlg)
import Data.Match.Fix (Fix())
import Data.Match.Subset ((<:)(..))
import Data.Match.Subset (type (<:)(..))
import Data.ConstrainedList (TraversableList(..), Traversables(trep))

import Prelude hiding (sequence)
Expand Down
1 change: 0 additions & 1 deletion src/Data/Match/Subset.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
, TypeOperators
, MultiParamTypeClasses
, FlexibleInstances
, OverlappingInstances
#-}

module Data.Match.Subset where
Expand Down