1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Aeson
import Data.Aeson.Encode.Pretty (encodePretty)
import qualified Data.ByteString.Lazy.Char8 as BL
import System.Environment (getArgs)
import Case
main :: IO ()
main = do
args <- getArgs
xs <- getContents
if not (null args) -- "-w"
then printWire xs
else printJSON xs
printWire :: String -> IO ()
printWire = print . sourceToWire . read
printJSON :: String -> IO ()
printJSON = BL.putStrLn . encodePretty . toJSON . wireToCase . read
|