Move more base stuff into Types module
This commit is contained in:
parent
de6495d750
commit
e3868332be
|
@ -1,13 +1,8 @@
|
||||||
{-# LANGUAGE GADTs #-}
|
|
||||||
{-# LANGUAGE FunctionalDependencies #-}
|
|
||||||
module Functions where
|
module Functions where
|
||||||
|
|
||||||
import Types
|
import Types
|
||||||
import Sources
|
import Sources
|
||||||
|
|
||||||
class (SourceState a, Show f) => IsFunction f a b | f -> a b where
|
|
||||||
runF :: f -> a -> b
|
|
||||||
|
|
||||||
data IsImageFilename = IsImageFilename deriving (Show)
|
data IsImageFilename = IsImageFilename deriving (Show)
|
||||||
instance IsFunction IsImageFilename FilePath Bool where
|
instance IsFunction IsImageFilename FilePath Bool where
|
||||||
runF IsImageFilename _path = undefined
|
runF IsImageFilename _path = undefined
|
||||||
|
@ -17,9 +12,6 @@ instance IsFunction ConvertedImageFilename FilePath FilePath where
|
||||||
runF ConvertedImageFilename _path = undefined
|
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)
|
data ListDirectory = ListDirectory deriving (Show)
|
||||||
instance IsFunctionIO ListDirectory FilePath [FilePath] where
|
instance IsFunctionIO ListDirectory FilePath [FilePath] where
|
||||||
runFIO ListDirectory _path = undefined
|
runFIO ListDirectory _path = undefined
|
||||||
|
|
|
@ -2,14 +2,9 @@ module Sources where
|
||||||
|
|
||||||
import Types
|
import Types
|
||||||
|
|
||||||
import Data.ByteString (ByteString)
|
|
||||||
|
|
||||||
data Source a where
|
data Source a where
|
||||||
Data :: a -> Source a
|
Data :: a -> Source a
|
||||||
|
|
||||||
class SourceState a where
|
|
||||||
stateOfSource :: a -> IO ByteString
|
|
||||||
|
|
||||||
instance SourceState FilePath where
|
instance SourceState FilePath where
|
||||||
stateOfSource = undefined
|
stateOfSource = undefined
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,17 @@
|
||||||
|
{-# LANGUAGE FunctionalDependencies #-}
|
||||||
module Types where
|
module Types where
|
||||||
|
|
||||||
|
import Data.ByteString (ByteString)
|
||||||
|
|
||||||
data Image = Image
|
data Image = Image
|
||||||
deriving (Show)
|
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue