From bb52c043cd4358508066ea67c0c4cd06a0472276 Mon Sep 17 00:00:00 2001 From: "Niels G. W. Serup" Date: Sat, 21 Sep 2024 17:39:50 +0200 Subject: [PATCH] Remove duplicated old way of doing this --- byg/src/ComputationM.hs | 7 ++----- byg/src/Functions.hs | 15 ++++++--------- byg/src/Main.hs | 4 ++-- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/byg/src/ComputationM.hs b/byg/src/ComputationM.hs index c766481..947e255 100644 --- a/byg/src/ComputationM.hs +++ b/byg/src/ComputationM.hs @@ -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 _ = "" @@ -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 diff --git a/byg/src/Functions.hs b/byg/src/Functions.hs index a959be6..9814068 100644 --- a/byg/src/Functions.hs +++ b/byg/src/Functions.hs @@ -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 diff --git a/byg/src/Main.hs b/byg/src/Main.hs index ea4c757..5c3d2c5 100644 --- a/byg/src/Main.hs +++ b/byg/src/Main.hs @@ -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 ()