git @ Cat's Eye Technologies Pail / master src / Main.hs
master

Tree @master (Download .tar.gz)

Main.hs @masterraw · history · blame

module Main where

-- Copyright (c) 2011-2024, Chris Pressey, Cat's Eye Technologies.
-- 
-- SPDX-License-Identifier: LicenseRef-BSD-2-Clause-X-Pail

import System.Environment
import System.Exit
import System.IO

import Language.Pail (runPail)


main = do
    args <- getArgs
    case args of
        [fileName] -> do
            c <- readFile fileName
            putStrLn $ runPail c
            return ()
        _ -> do
            abortWith "Usage: pail <filename.pail>"

abortWith msg = do
    hPutStrLn stderr msg
    exitWith (ExitFailure 1)