Add skeletons for function implementations

This commit is contained in:
Niels G. W. Serup 2024-09-24 21:14:27 +02:00
parent 9376ede653
commit 61387f6eba
No known key found for this signature in database
GPG Key ID: 38EEEBCE67324F19
4 changed files with 33 additions and 3 deletions

View File

@ -5,4 +5,12 @@ module Evaluation.Function
import Types (Function(..), Value(..)) import Types (Function(..), Value(..))
evalFunction :: Function -> Value -> Value evalFunction :: Function -> Value -> Value
evalFunction = undefined evalFunction f x = case (f, x) of
(IsImageFilename, String _) ->
Bool undefined
(ConvertedImageFilename, String _) ->
String undefined
_ ->
error "unexpected combination of function and argument type"

View File

@ -5,4 +5,21 @@ module Evaluation.FunctionIO
import Types (FunctionIO(..), Value(..)) import Types (FunctionIO(..), Value(..))
evalFunctionIO :: FunctionIO -> Value -> IO Value evalFunctionIO :: FunctionIO -> Value -> IO Value
evalFunctionIO = undefined evalFunctionIO f x = case (f, x) of
(ListDirectory, String _) ->
pure $ List undefined
(ReadTemplate, String _) ->
pure $ Template undefined
(ConvertImage, Tuple (Tuple (String _, String _), ImageConversionSettings _)) ->
pure $ Empty
(SaveFile, Tuple (String _, String _)) ->
pure $ Empty
(RunPandoc, String _) ->
pure $ String undefined
_ ->
error "unexpected combination of function and argument type"

View File

@ -8,7 +8,12 @@ import Types.Values
import Language.Haskell.TH.Syntax (Lift) import Language.Haskell.TH.Syntax (Lift)
data Value = String String data Value = String String
| Bool Bool
| ImageConversionSettings ImageConversionSettings | ImageConversionSettings ImageConversionSettings
| Template Template
| Empty
| Tuple (Value, Value)
| List [Value]
deriving (Show, Lift) deriving (Show, Lift)
class Valuable a where class Valuable a where

View File

@ -13,5 +13,5 @@ data TemplatePart = Literal String
| KeyValue String | KeyValue String
deriving (Show, Lift) deriving (Show, Lift)
data Template = Template [TemplatePart] data Template = TemplateParts [TemplatePart]
deriving (Show, Lift) deriving (Show, Lift)