Remove unneeded type constraints
This commit is contained in:
parent
f4bca41377
commit
ad3bba2d1a
|
@ -26,7 +26,6 @@ import Types.Dependency (Action(..), Dependency, makeDependency)
|
|||
|
||||
import Control.Monad.State (MonadState, State, runState, put, get)
|
||||
import Control.Monad.Writer (MonadWriter, WriterT, execWriterT, tell)
|
||||
import Language.Haskell.TH.Syntax (Lift)
|
||||
|
||||
newtype DepGenM' a = DepGenM { unDepGenM :: WriterT [Dependency] (State Int) a }
|
||||
deriving (Functor, Applicative, Monad, MonadState Int, MonadWriter [Dependency])
|
||||
|
@ -42,7 +41,7 @@ evalDepGenM m = fst (evalDepGenM' 0 m)
|
|||
tellDep :: Dependency -> DepGenM' ()
|
||||
tellDep dep = tell [dep]
|
||||
|
||||
genDependencyM :: (Show a, Lift a) => (Token a -> DepGenM' Dependency) -> DepGenM a
|
||||
genDependencyM :: (Token a -> DepGenM' Dependency) -> DepGenM a
|
||||
genDependencyM f = do
|
||||
top <- get
|
||||
let top' = top + 1
|
||||
|
@ -52,27 +51,27 @@ genDependencyM f = do
|
|||
tellDep result
|
||||
pure target
|
||||
|
||||
genDependency :: (Show a, Lift a) => (Token a -> Dependency) -> DepGenM a
|
||||
genDependency :: (Token a -> Dependency) -> DepGenM a
|
||||
genDependency f = genDependencyM (pure . f)
|
||||
|
||||
inject :: (Show a, Lift a, Valuable a) => a -> DepGenM a
|
||||
inject :: Valuable a => a -> DepGenM a
|
||||
inject x = genDependency (makeDependency NoToken (Inject (toValue x)))
|
||||
|
||||
getListElem :: (Show a, Lift a) => Token [a] -> DepGenM a
|
||||
getListElem :: Token [a] -> DepGenM a
|
||||
getListElem outer = genDependency (makeDependency outer GetListElem)
|
||||
|
||||
setListElem :: (Show a, Lift a) => Token a -> Token [a] -> DepGenM ()
|
||||
setListElem :: Token a -> Token [a] -> DepGenM ()
|
||||
setListElem a outer = do
|
||||
tellDep (makeDependency a SetListElem outer)
|
||||
pure NoToken
|
||||
|
||||
runFunction :: (Show a, Show b, Lift a, Lift b) => Function -> Token a -> DepGenM b
|
||||
runFunction :: Function -> Token a -> DepGenM b
|
||||
runFunction f input = genDependency (makeDependency input (Function f))
|
||||
|
||||
runFunctionIO :: (Show a, Show b, Lift a, Lift b) => FunctionIO -> Token a -> DepGenM b
|
||||
runFunctionIO :: FunctionIO -> Token a -> DepGenM b
|
||||
runFunctionIO f input = genDependency (makeDependency input (FunctionIO f))
|
||||
|
||||
mapDepGenM :: (Show a, Show b, Lift a, Lift b) => (Token a -> DepGenM b) -> Token [a] -> DepGenM [b]
|
||||
mapDepGenM :: (Token a -> DepGenM b) -> Token [a] -> DepGenM [b]
|
||||
mapDepGenM f input = genDependencyM $ \target -> do
|
||||
top <- get
|
||||
let (res, top') = evalDepGenM' top $ do
|
||||
|
@ -82,12 +81,12 @@ mapDepGenM f input = genDependencyM $ \target -> do
|
|||
put top'
|
||||
pure (makeDependency input (MapComp res) target)
|
||||
|
||||
mapDepGenM_ :: (Show a, Lift a) => (Token a -> DepGenM ()) -> Token [a] -> DepGenM ()
|
||||
mapDepGenM_ :: (Token a -> DepGenM ()) -> Token [a] -> DepGenM ()
|
||||
mapDepGenM_ f input = do
|
||||
_ <- mapDepGenM f input
|
||||
pure NoToken
|
||||
|
||||
filterDepGenM :: (Show a, Lift a) => (Token a -> DepGenM Bool) -> Token [a] -> DepGenM [a]
|
||||
filterDepGenM :: (Token a -> DepGenM Bool) -> Token [a] -> DepGenM [a]
|
||||
filterDepGenM f input = do
|
||||
conds <- mapDepGenM f input
|
||||
genDependency (makeDependency (TupleToken input conds) FilterComp)
|
||||
|
|
|
@ -30,7 +30,7 @@ data UToken = UToken Int
|
|||
data Dependency = Dependency UToken Action UToken
|
||||
deriving (Show, Lift)
|
||||
|
||||
makeDependency :: (Show a, Show b, Lift a, Lift b) => Token a -> Action -> Token b -> Dependency
|
||||
makeDependency :: Token a -> Action -> Token b -> Dependency
|
||||
makeDependency a action b = Dependency (makeUToken a) action (makeUToken b)
|
||||
|
||||
makeUToken :: Token a -> UToken
|
||||
|
|
Loading…
Reference in New Issue