From e3868332be9608c8d2e6759f78f19bcf4e79d5e5 Mon Sep 17 00:00:00 2001 From: "Niels G. W. Serup" Date: Sat, 21 Sep 2024 19:53:32 +0200 Subject: [PATCH] Move more base stuff into Types module --- byg/src/Functions.hs | 8 -------- byg/src/Sources.hs | 5 ----- byg/src/Types.hs | 13 +++++++++++++ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/byg/src/Functions.hs b/byg/src/Functions.hs index cdeef36..7a942dc 100644 --- a/byg/src/Functions.hs +++ b/byg/src/Functions.hs @@ -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 diff --git a/byg/src/Sources.hs b/byg/src/Sources.hs index 28a7fe8..ede5806 100644 --- a/byg/src/Sources.hs +++ b/byg/src/Sources.hs @@ -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 diff --git a/byg/src/Types.hs b/byg/src/Types.hs index 40ebc50..dfc5c44 100644 --- a/byg/src/Types.hs +++ b/byg/src/Types.hs @@ -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 +