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 | data TypedRun a b where | ||||||
|   F :: Function a b -> TypedRun a b |   F :: Function a b -> TypedRun a b | ||||||
|   FIO' :: IsFIO f a b => f -> TypedRun a b |   FIO :: IsFIO f a b => f -> TypedRun a b | ||||||
|   FIO :: FunctionIO a b -> TypedRun a b |  | ||||||
|   TInject :: b -> TypedRun () b |   TInject :: b -> TypedRun () b | ||||||
|   InList :: ComputationM TokenNotTraversable b -> TypedRun [a] [b] |   InList :: ComputationM TokenNotTraversable b -> TypedRun [a] [b] | ||||||
| 
 | 
 | ||||||
| testtr = FIO' ListDirectory' |  | ||||||
| 
 |  | ||||||
| instance Show (ComputationM t a) where | instance Show (ComputationM t a) where | ||||||
|   show _ = "<computation>" |   show _ = "<computation>" | ||||||
| 
 | 
 | ||||||
| @ -76,7 +73,7 @@ inject :: Show a => a -> ComputationM ta a | |||||||
| inject x = genDependency (Dependency NoToken (TInject x)) | inject x = genDependency (Dependency NoToken (TInject x)) | ||||||
| 
 | 
 | ||||||
| runIO :: (Show a, Show b, IsFIO f a b) => f -> Token t a -> ComputationM TokenNotTraversable b | 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 TokenNotTraversable [a] -> Token TokenTraversable (Token TokenNotTraversable a) | ||||||
| makeTraversable (Token n) = Token n | makeTraversable (Token n) = Token n | ||||||
|  | |||||||
| @ -16,8 +16,6 @@ data Function a b where | |||||||
| deriving instance Show (Function a b) | deriving instance Show (Function a b) | ||||||
| 
 | 
 | ||||||
| data FunctionIO a b where | data FunctionIO a b where | ||||||
|   ListDirectory :: FunctionIO FilePath [FilePath] |  | ||||||
|   OpenImage :: FunctionIO FilePath Image |  | ||||||
|   ConvertImage :: FunctionIO (Image, ImageConversion) Image |   ConvertImage :: FunctionIO (Image, ImageConversion) Image | ||||||
|   Save :: FunctionIO (a, FilePath) () |   Save :: FunctionIO (a, FilePath) () | ||||||
|   RunPandoc :: FunctionIO String String |   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 | class (SourceState a, Show f) => IsFIO f a b | f -> a b where | ||||||
|   runFIO :: f -> a -> IO b |   runFIO :: f -> a -> IO b | ||||||
| 
 | 
 | ||||||
| 
 | data ListDirectory = ListDirectory | ||||||
| data ListDirectory' = ListDirectory' |  | ||||||
|   deriving (Show) |   deriving (Show) | ||||||
| instance IsFIO ListDirectory' FilePath [FilePath] where | instance IsFIO ListDirectory FilePath [FilePath] where | ||||||
|   runFIO ListDirectory' path = undefined |   runFIO ListDirectory path = undefined | ||||||
| 
 | 
 | ||||||
| data OpenImage' = OpenImage' | data OpenImage = OpenImage | ||||||
|   deriving (Show) |   deriving (Show) | ||||||
| instance IsFIO OpenImage' FilePath Image where | instance IsFIO OpenImage FilePath Image where | ||||||
|   runFIO OpenImage' path = undefined |   runFIO OpenImage path = undefined | ||||||
|  | |||||||
| @ -6,9 +6,9 @@ import ComputationM | |||||||
| test :: ComputationM TokenNotTraversable () | test :: ComputationM TokenNotTraversable () | ||||||
| test = do | test = do | ||||||
|   dir <- inject "retter" |   dir <- inject "retter" | ||||||
|   dirContents <- runIO ListDirectory' dir |   dirContents <- runIO ListDirectory dir | ||||||
|   let dirContents' = makeTraversable dirContents |   let dirContents' = makeTraversable dirContents | ||||||
|   u <- mapM (runIO OpenImage') dirContents' |   u <- mapM (runIO OpenImage) dirContents' | ||||||
|   pure $ NoToken |   pure $ NoToken | ||||||
| 
 | 
 | ||||||
| main :: IO () | main :: IO () | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user