-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathLib3.hs
More file actions
34 lines (26 loc) · 766 Bytes
/
Copy pathLib3.hs
File metadata and controls
34 lines (26 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{-# LANGUAGE DeriveFunctor #-}
module Lib3
( executeSql,
Execution,
ExecutionAlgebra(..)
)
where
import Control.Monad.Free (Free (..), liftF)
import DataFrame (DataFrame)
import Data.Time ( UTCTime )
type TableName = String
type FileContent = String
type ErrorMessage = String
data ExecutionAlgebra next
= LoadFile TableName (FileContent -> next)
| GetTime (UTCTime -> next)
-- feel free to add more constructors here
deriving Functor
type Execution = Free ExecutionAlgebra
loadFile :: TableName -> Execution FileContent
loadFile name = liftF $ LoadFile name id
getTime :: Execution UTCTime
getTime = liftF $ GetTime id
executeSql :: String -> Execution (Either ErrorMessage DataFrame)
executeSql sql = do
return $ Left "implement me"