gdritter repos telml / 9a6eb4c
Removed `from-telml` executable, which bloated dependencies for little reason Getty Ritter 8 years ago
2 changed file(s) with 5 addition(s) and 36 deletion(s). Collapse all Expand all
+0
-26
src/Main.hs less more
1 {-# LANGUAGE OverloadedStrings #-}
2
3 module Main where
4
5 import Data.Aeson (Value(..), encode, object, (.=))
6 import qualified Data.ByteString.Lazy.Char8 as BS
7 import Data.TeLML
8 import Data.Vector (fromList)
9 import qualified Data.Text as T
10
11 telmlToValue :: Fragment -> Value
12 telmlToValue (Text t) = String (T.pack t)
13 telmlToValue (Tag t ts) = object
14 [ "name" .= String (T.pack t)
15 , "contents" .= arr (map (arr . map telmlToValue) ts)
16 ]
17 where arr = Array . fromList
18
19 fromRight (Right x) = x
20 fromRight _ = undefined
21
22 main = do
23 r <- fmap parse getContents
24 case r of
25 Right x -> BS.putStrLn . encode . map telmlToValue $ x
26 Left err -> putStrLn err
11 name: telml
22 version: 0.1.0.0
3 synopsis: foo
4 description: foo
3 synopsis: A lightweight TeX-like markup format.
4 description: A lightweight TeX-like markup format.
55 license: BSD3
66 license-file: LICENSE
77 author: Getty Ritter
88 maintainer: gdritter@galois.com
9 copyright: ©2015
9 copyright: ©2015 Getty Ritter
1010 category: Data
1111 build-type: Simple
1212 cabal-version: >=1.10
1414 library
1515 exposed-modules: Data.TeLML
1616 other-modules: Data.TeLML.Parser, Data.TeLML.Type
17 build-depends: base >=4.7 && <4.9, deepseq
17 build-depends: base >=4.7 && <4.9,
18 deepseq >=1.4 && <2
1819 default-language: Haskell2010
19
20 executable from-telml
21 main-is: Main.hs
22 hs-source-dirs: src
23 build-depends: base >=4.7 && <4.8, aeson, telml, vector, text, bytestring
24 default-language: Haskell2010