Remove duplicated old way of doing this
This commit is contained in:
parent
6a2a87cfc3
commit
bb52c043cd
|
@ -16,13 +16,10 @@ data ComputationRun a b = ComputationRun (Function a b)
|
|||
|
||||
data TypedRun a b where
|
||||
F :: Function a b -> TypedRun a b
|
||||
FIO' :: IsFIO f a b => f -> TypedRun a b
|
||||
FIO :: FunctionIO a b -> TypedRun a b
|
||||
FIO :: IsFIO f a b => f -> TypedRun a b
|
||||
TInject :: b -> TypedRun () b
|
||||
InList :: ComputationM TokenNotTraversable b -> TypedRun [a] [b]
|
||||
|
||||
testtr = FIO' ListDirectory'
|
||||
|
||||
instance Show (ComputationM t a) where
|
||||
show _ = "<computation>"
|
||||
|
||||
|
@ -76,7 +73,7 @@ inject :: Show a => a -> ComputationM ta a
|
|||
inject x = genDependency (Dependency NoToken (TInject x))
|
||||
|
||||
runIO :: (Show a, Show b, IsFIO f a b) => f -> Token t a -> ComputationM TokenNotTraversable b
|
||||
runIO f input = genDependency (Dependency input (FIO' f))
|
||||
runIO f input = genDependency (Dependency input (FIO f))
|
||||
|
||||
makeTraversable :: Token TokenNotTraversable [a] -> Token TokenTraversable (Token TokenNotTraversable a)
|
||||
makeTraversable (Token n) = Token n
|
||||
|
|
|
@ -16,8 +16,6 @@ data Function a b where
|
|||
deriving instance Show (Function a b)
|
||||
|
||||
data FunctionIO a b where
|
||||
ListDirectory :: FunctionIO FilePath [FilePath]
|
||||
OpenImage :: FunctionIO FilePath Image
|
||||
ConvertImage :: FunctionIO (Image, ImageConversion) Image
|
||||
Save :: FunctionIO (a, FilePath) ()
|
||||
RunPandoc :: FunctionIO String String
|
||||
|
@ -29,13 +27,12 @@ deriving instance Show (FunctionIO a b)
|
|||
class (SourceState a, Show f) => IsFIO f a b | f -> a b where
|
||||
runFIO :: f -> a -> IO b
|
||||
|
||||
|
||||
data ListDirectory' = ListDirectory'
|
||||
data ListDirectory = ListDirectory
|
||||
deriving (Show)
|
||||
instance IsFIO ListDirectory' FilePath [FilePath] where
|
||||
runFIO ListDirectory' path = undefined
|
||||
instance IsFIO ListDirectory FilePath [FilePath] where
|
||||
runFIO ListDirectory path = undefined
|
||||
|
||||
data OpenImage' = OpenImage'
|
||||
data OpenImage = OpenImage
|
||||
deriving (Show)
|
||||
instance IsFIO OpenImage' FilePath Image where
|
||||
runFIO OpenImage' path = undefined
|
||||
instance IsFIO OpenImage FilePath Image where
|
||||
runFIO OpenImage path = undefined
|
||||
|
|
|
@ -6,9 +6,9 @@ import ComputationM
|
|||
test :: ComputationM TokenNotTraversable ()
|
||||
test = do
|
||||
dir <- inject "retter"
|
||||
dirContents <- runIO ListDirectory' dir
|
||||
dirContents <- runIO ListDirectory dir
|
||||
let dirContents' = makeTraversable dirContents
|
||||
u <- mapM (runIO OpenImage') dirContents'
|
||||
u <- mapM (runIO OpenImage) dirContents'
|
||||
pure $ NoToken
|
||||
|
||||
main :: IO ()
|
||||
|
|
Loading…
Reference in New Issue