aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/Main.hs
blob: 7a8bffaedf198a3c6e08567cecdcfc2219f24ef7 (plain) (blame)
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 LambdaCase #-}

module Main
  ( main
  ) where

import           Lib
import           System.Environment             ( getArgs )
import           Term

reduce :: String -> IO ()
reduce path = do
  file <- readFile path
  let termified = fromJotter file
  putStrLn $ "input: " ++ show termified
  normal <- nf termified
  putStrLn $ "reduced: " ++ show normal

main :: IO ()
main = do
  args <- getArgs
  case args of
    ["reduce", path] -> reduce path
    _                -> putStrLn "Usage: jotter [transpile|reduce] <file>"