initial skeleton
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
bin/
|
20
LICENSE
Normal file
20
LICENSE
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
Copyright (c) 2017 Veit Heller
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
4
README.md
Normal file
4
README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# bc
|
||||||
|
|
||||||
|
A better basic calculator. Like the original `bc`, but with a better
|
||||||
|
prompt.
|
20
bc.cabal
Normal file
20
bc.cabal
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
name: bc
|
||||||
|
version: 0.1.0.0
|
||||||
|
synopsis: A better calculator
|
||||||
|
description: Like bc, but with a better prompt.
|
||||||
|
license: MIT
|
||||||
|
license-file: LICENSE
|
||||||
|
author: Veit Heller
|
||||||
|
maintainer: veit@veitheller.de
|
||||||
|
copyright:
|
||||||
|
category: Language
|
||||||
|
build-type: Simple
|
||||||
|
extra-source-files: ChangeLog.md, README.md
|
||||||
|
cabal-version: >=1.10
|
||||||
|
|
||||||
|
executable bc
|
||||||
|
main-is: Main.hs
|
||||||
|
other-modules:
|
||||||
|
build-depends: base >=4.9 && <4.10
|
||||||
|
hs-source-dirs: src
|
||||||
|
default-language: Haskell2010
|
5
src/BC/Config.hs
Normal file
5
src/BC/Config.hs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module Bc.Prompt where
|
||||||
|
|
||||||
|
versionStr = "0.1.0.0"
|
||||||
|
|
||||||
|
prompt = "> "
|
24
src/BC/Prompt.hs
Normal file
24
src/BC/Prompt.hs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
module BC.Prompt (startPrompt) where
|
||||||
|
|
||||||
|
import BC.Config
|
||||||
|
|
||||||
|
printHeader :: IO ()
|
||||||
|
printHeader = do
|
||||||
|
putStrLn "bc (better calculator) version " ++ versionStr
|
||||||
|
putStrLn "Copyright 2017 Veit Heller"
|
||||||
|
putStrLn "This is free software with ABSOLUTELY NO WARRANTY.\n"
|
||||||
|
|
||||||
|
|
||||||
|
prompt :: IO ()
|
||||||
|
prompt = runInputT settings $ poll prompt
|
||||||
|
where poll p = do
|
||||||
|
input <- getInputLine p
|
||||||
|
case input of
|
||||||
|
Nothing -> return ""
|
||||||
|
Just str -> return str
|
||||||
|
|
||||||
|
|
||||||
|
startPrompt :: IO ()
|
||||||
|
startPrompt = do
|
||||||
|
printHeader
|
||||||
|
prompt
|
6
src/Main.hs
Normal file
6
src/Main.hs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
module Main where
|
||||||
|
|
||||||
|
import BC.Prompt
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = startPrompt
|
Reference in New Issue
Block a user