Move more base stuff into Types module

Šī revīzija ir iekļauta:
2024-09-21 19:53:32 +02:00
vecāks de6495d750
revīzija e3868332be
3 mainīti faili ar 13 papildinājumiem un 13 dzēšanām

Parādīt failu

@@ -1,13 +1,8 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE FunctionalDependencies #-}
module Functions where
import Types
import Sources
class (SourceState a, Show f) => IsFunction f a b | f -> a b where
runF :: f -> a -> b
data IsImageFilename = IsImageFilename deriving (Show)
instance IsFunction IsImageFilename FilePath Bool where
runF IsImageFilename _path = undefined
@@ -17,9 +12,6 @@ instance IsFunction ConvertedImageFilename FilePath FilePath where
runF ConvertedImageFilename _path = undefined
class (SourceState a, Show f) => IsFunctionIO f a b | f -> a b where
runFIO :: f -> a -> IO b
data ListDirectory = ListDirectory deriving (Show)
instance IsFunctionIO ListDirectory FilePath [FilePath] where
runFIO ListDirectory _path = undefined

Parādīt failu

@@ -2,14 +2,9 @@ module Sources where
import Types
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

Parādīt failu

@@ -1,4 +1,17 @@
{-# LANGUAGE FunctionalDependencies #-}
module Types where
import Data.ByteString (ByteString)
data Image = Image
deriving (Show)
class (SourceState a, Show f) => IsFunction f a b | f -> a b where
runF :: f -> a -> b
class (SourceState a, Show f) => IsFunctionIO f a b | f -> a b where
runFIO :: f -> a -> IO b
class SourceState a where
stateOfSource :: a -> IO ByteString