ZJ6BESB2ZX5KZWQRANKZFHPP64H3WQHF56PMFFMZIKVSIZSX3SXAC
module Main (main) where
main :: IO ()
main = putStrLn "Test suite not yet implemented."
module Budget (
Positive,
calculate,
positive,
getPositive,
) where
data Budget = Budget
{ needs :: Positive
, wants :: Positive
, savings :: Positive
}
deriving (Show)
newtype Positive = Positive {unPositive :: Word} deriving (Show)
type Income = Positive
positive :: Int -> Maybe Positive
positive x
| x > 0 = Just . Positive . fromIntegral $ x
| otherwise = Nothing
getPositive :: Positive -> Word
getPositive = unPositive
calculate :: Income -> Budget
calculate (Positive income) = Budget (Positive needs) (Positive wants) (Positive savings)
where
needs = income `quot` 2
wants = income - needs - savings
savings = income `quot` 5
cabal-version: 2.4
name: budget
version: 0.1.0.0
synopsis: A personal budgeting app
-- A longer description of the package.
-- description:
homepage:
-- A URL where users can report bugs.
-- bug-reports:
license: MIT
license-file: LICENSE
author: Wgaffa
maintainer: subscription@skriptladan.se
-- A copyright notice.
-- copyright:
category: Finance
extra-source-files: CHANGELOG.md
library
exposed-modules: Budget
-- Modules included in this library but not exported.
-- other-modules:
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
build-depends: base ^>=4.16.4.0
hs-source-dirs: lib
default-language: Haskell2010
executable budget
main-is: Main.hs
-- Modules included in this executable, other than Main.
-- other-modules:
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
build-depends:
base ^>=4.16.4.0,
budget
hs-source-dirs: app
default-language: Haskell2010
test-suite budget-test
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: MyLibTest.hs
build-depends: base ^>=4.16.4.0
module Main where
import qualified MyLib (someFunc)
main :: IO ()
main = do
putStrLn "Hello, Haskell!"
MyLib.someFunc
Copyright (c) 2023 Wgaffa
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.
# Revision history for budget
## 0.1.0.0 -- YYYY-mm-dd
* First version. Released on an unsuspecting world.