Add skeletons for function implementations
This commit is contained in:
parent
9376ede653
commit
61387f6eba
|
@ -5,4 +5,12 @@ module Evaluation.Function
|
|||
import Types (Function(..), 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"
|
||||
|
|
|
@ -5,4 +5,21 @@ module Evaluation.FunctionIO
|
|||
import Types (FunctionIO(..), 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"
|
||||
|
|
|
@ -8,7 +8,12 @@ import Types.Values
|
|||
import Language.Haskell.TH.Syntax (Lift)
|
||||
|
||||
data Value = String String
|
||||
| Bool Bool
|
||||
| ImageConversionSettings ImageConversionSettings
|
||||
| Template Template
|
||||
| Empty
|
||||
| Tuple (Value, Value)
|
||||
| List [Value]
|
||||
deriving (Show, Lift)
|
||||
|
||||
class Valuable a where
|
||||
|
|
|
@ -13,5 +13,5 @@ data TemplatePart = Literal String
|
|||
| KeyValue String
|
||||
deriving (Show, Lift)
|
||||
|
||||
data Template = Template [TemplatePart]
|
||||
data Template = TemplateParts [TemplatePart]
|
||||
deriving (Show, Lift)
|
||||
|
|
Loading…
Reference in New Issue