summaryrefslogtreecommitdiff
path: root/examples/example0/Example0.hs
diff options
context:
space:
mode:
authorYvesPares <>2019-10-09 10:16:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-10-09 10:16:00 (GMT)
commit0a26644cffcc096b169b4f1ee3b790b562c01c51 (patch)
tree0404a48f10a79540a26f315f0af2da316474e3a9 /examples/example0/Example0.hs
version 0.1.0.00.1.0.0
Diffstat (limited to 'examples/example0/Example0.hs')
-rw-r--r--examples/example0/Example0.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/example0/Example0.hs b/examples/example0/Example0.hs
new file mode 100644
index 0000000..a8e74c3
--- /dev/null
+++ b/examples/example0/Example0.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE Arrows #-}
+
+import Data.DocRecord
+import qualified Data.Text.Lazy as T
+import Porcupine
+
+
+resultFile :: DataSink T.Text
+resultFile = dataSink ["result"] $
+ somePureSerial (PlainTextSerial (Just "txt"))
+
+myTask :: (LogThrow m) => PTask m () ()
+myTask = proc () -> do
+ (FV char :& FV num :& _) <- getMyOptions -< ()
+ let txt = T.replicate (fromIntegral num) (T.singleton char)
+ writeData resultFile -< txt
+ where
+ getMyOptions =
+ getOptions ["options"]
+ ( docField @"char" 'a' "The character to repeat"
+ :& docField @"replications" (10::Int) "The number of replications"
+ :& RNil)
+
+main :: IO ()
+-- main = simpleRunPTask myTask ()
+main = runLocalPipelineTask (FullConfig "example0" "example0.yaml" "." ()) myTask ()