Commit 6b00c323 authored by Michael Hanus 's avatar Michael Hanus

Local implementation of Control.Monad.State removed and replaced by using the transformers package

parent 477893ac
{
"name": "icurry",
"version": "3.0.0",
"version": "3.0.1",
"author": "Michael Hanus <mh@informatik.uni-kiel.de>",
"synopsis": "Intermediate format for compiling Curry to imperative languages",
"category": [ "Metaprogramming" ],
"license": "BSD-3-Clause",
"licenseFile": "LICENSE",
"dependencies": {
"base" : ">= 1.0.0, < 2.0.0",
"currypath" : ">= 0.0.1",
"flatcurry" : ">= 2.0.0, < 3.0.0",
"graphviz" : ">= 2.0.0, < 3.0.0"
"base" : ">= 1.0.0, < 2.0.0",
"currypath" : ">= 0.0.1",
"flatcurry" : ">= 2.0.0, < 3.0.0",
"graphviz" : ">= 2.0.0, < 3.0.0",
"transformers" : ">= 2.0.0"
},
"compilerCompatibility": {
"pakcs": ">= 2.0.0, < 3.0.0",
......
module Control.Monad.State where
data State s a = State (s -> (a, s))
{-
instance Applicative (State s) where
pure x = State (\s -> (x,s))
(State ff) <*> (State g) = State (\s -> let (f,s1) = ff s
(a,s2) = g s1
result = (f a,s2)
in result)
-}
instance Functor (State s) where
fmap f (State g) = State $ \s -> let (a,s1) = g s in (f a,s1)
instance Monad (State s) where
return x = state (\s -> (x, s))
m >>= f = state (\s -> let (x, s') = runState m s
in runState (f x) s')
runState :: State s a -> (s -> (a,s))
runState (State st) = st
state :: (s -> (a, s)) -> State s a
state = State
get :: State s s
get = state (\s -> (s, s))
put :: s -> State s ()
put s = state (\_ -> ((), s))
modify :: (s -> s) -> State s ()
modify f = state (\s -> ((), f s))
evalState :: State s a -> s -> a
evalState m s = fst (runState m s)
execState :: State s a -> s -> s
execState m s = snd (runState m s)
......@@ -7,15 +7,15 @@
--- should only be used if the actual function types are irrelevant!
---
--- @author Michael Hanus
--- @version February 2020
--- @version June 2020
------------------------------------------------------------------------------
module FlatCurry.CaseLifting where
import List ( maximum, union )
import Control.Monad.State
import FlatCurry.Goodies ( allVars, funcName )
import Control.Monad.Trans.State ( State, get, put, modify, evalState )
import FlatCurry.Goodies ( allVars, funcName )
import FlatCurry.Types
------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment