From 0888749f7c6c50e6fb80ca96db67aadf04c5375c Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 29 May 2017 11:42:21 -0400 Subject: [PATCH] Define the terms for a language of tasks. --- src/Semantic.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Semantic.hs b/src/Semantic.hs index 1e4054702..a451d9368 100644 --- a/src/Semantic.hs +++ b/src/Semantic.hs @@ -7,6 +7,7 @@ module Semantic ) where import qualified Control.Concurrent.Async as Async +import Control.Monad.Free.Freer import Data.Functor.Both import Data.Record import Diff @@ -66,6 +67,14 @@ parseBlob decorator SourceBlob{..} = decorator source <$> runParser (parserForLa type Decorator input output = Source -> input -> output +data TaskF output where + Parse :: Parser term -> Source -> TaskF term + Decorate :: Decorator term term' -> Source -> term -> TaskF term' + Render :: Monoid output => Renderer input output -> input -> TaskF output + +type Task = Freer TaskF + + -- Internal renderConcurrently :: (Monoid output, StringConv output ByteString) => (input -> IO output) -> [input] -> IO ByteString