Start using class instances instead of GADT constructors
Maybe makes more sense here?
This commit is contained in:
		
							parent
							
								
									124d9fa4d8
								
							
						
					
					
						commit
						6a2a87cfc3
					
				| @ -75,8 +75,8 @@ genDependency g = do | |||||||
| inject :: Show a => a -> ComputationM ta a | 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) => FunctionIO a b -> 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 | ||||||
|  | |||||||
| @ -34,3 +34,8 @@ 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' | ||||||
|  |   deriving (Show) | ||||||
|  | instance IsFIO OpenImage' FilePath Image where | ||||||
|  |   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