1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 07:25:44 +03:00
semantic/src/Command.hs

22 lines
462 B
Haskell
Raw Normal View History

2017-03-31 19:58:17 +03:00
{-# LANGUAGE GADTs #-}
2017-03-31 18:52:51 +03:00
module Command
( module C
) where
import Command.Diff as C
import Command.Parse as C
2017-03-31 19:58:17 +03:00
import Control.Monad.Free.Freer
import Prologue
import Source
data CommandF f where
ReadFile :: FilePath -> CommandF SourceBlob
type Command = Freer CommandF
2017-03-31 19:58:27 +03:00
runCommand :: Command a -> IO a
runCommand = iterFreerA $ \ command yield -> case command of
ReadFile path -> do
source <- readAndTranscodeFile path
yield (sourceBlob source path)