initial skeleton

This commit is contained in:
2017-04-27 19:29:42 +02:00
commit 639a513ad4
8 changed files with 82 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
bin/

20
LICENSE Normal file
View 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
View File

@@ -0,0 +1,4 @@
# bc
A better basic calculator. Like the original `bc`, but with a better
prompt.

2
Setup.hs Normal file
View File

@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain

20
bc.cabal Normal file
View 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
View File

@@ -0,0 +1,5 @@
module Bc.Prompt where
versionStr = "0.1.0.0"
prompt = "> "

24
src/BC/Prompt.hs Normal file
View 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
View File

@@ -0,0 +1,6 @@
module Main where
import BC.Prompt
main :: IO ()
main = startPrompt