Put sources functionality in its own file

This commit is contained in:
Niels G. W. Serup 2024-09-21 16:57:03 +02:00
parent 4e412e4366
commit 2549d5af1b
No known key found for this signature in database
GPG Key ID: 38EEEBCE67324F19
2 changed files with 16 additions and 20 deletions

View File

@ -6,11 +6,6 @@ module Main where
import Unsafe.Coerce (unsafeCoerce)
import Control.Monad.State
import Control.Monad.Writer
import Data.ByteString (ByteString)
data Source a where
-- Void :: Source ()
Data :: a -> Source a
-- data FlatComputation = Flat
@ -27,16 +22,6 @@ data Source a where
data ComputationRun a b = ComputationRun (Function a b)
| ComputationRunIO (FunctionIO a b)
class SourceState a where
stateOfSource :: a -> IO ByteString
-- makeChecker :: a -> IO (a -> Bool)
instance SourceState FilePath where
stateOfSource = undefined
-- makeChecker = undefined
class SourceState a => IsFIO f a b | f -> a b where
runFIO :: f -> a -> IO b
data ListDirectory' = ListDirectory'
instance IsFIO ListDirectory' FilePath [FilePath] where
@ -80,11 +65,6 @@ data Dependency ta a tb b = Dependency (Token ta a) (TypedRun a b) (Token tb b)
data DependencyUntyped where
DependencyUntyped :: Dependency ta a tb b -> String -> DependencyUntyped
--deriving instance Show DependencyUntyped
-- showDU :: DependencyUntyped -> String
-- showDU (DependencyUntyped d) = show d
instance Show DependencyUntyped where
show (DependencyUntyped _ s) = s

16
byg/src/Sources.hs Normal file
View File

@ -0,0 +1,16 @@
{-# LANGUAGE FunctionalDependencies #-}
module Sources where
import Data.ByteString (ByteString)
data Source a where
Data :: a -> Source a
class SourceState a where
stateOfSource :: a -> IO ByteString
instance SourceState FilePath where
stateOfSource = undefined
class SourceState a => IsFIO f a b | f -> a b where
runFIO :: f -> a -> IO b