Commit 2140869e authored by Oscar Leijendekker's avatar Oscar Leijendekker

Used do notation in taskDecoder

parent 0605d390
Pipeline #95049680 passed with stage
in 4 minutes and 16 seconds
......@@ -16,7 +16,6 @@ import qualified Hasql.Decoders
import qualified Data.Text
import qualified Data.ByteString.UTF8 as StrictUTF8 (fromString, toString)
data TaskStatus = Done | NotDone
data Task = Task String TaskStatus
......@@ -77,6 +76,7 @@ taskStatusDecoder = fmap boolToTaskStatus Hasql.Decoders.bool
stringDecoder :: Hasql.Decoders.Value String
stringDecoder = fmap Data.Text.unpack Hasql.Decoders.text
{-
stringDecoder_row :: Hasql.Decoders.Row String
stringDecoder_row = Hasql.Decoders.column stringDecoder
......@@ -85,3 +85,10 @@ taskStatusDecoder_row = Hasql.Decoders.column taskStatusDecoder
taskDecoder :: Hasql.Decoders.Row Task
taskDecoder = Task <$> stringDecoder_row <*> taskStatusDecoder_row
-}
taskDecoder :: Hasql.Decoders.Row Task
taskDecoder = do
taskDescription <- Hasql.Decoders.column stringDecoder
taskStatus <- Hasql.Decoders.column taskStatusDecoder
return $ Task taskDescription taskStatus
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment