mirror of
https://github.com/thma/LtuPatternFactory.git
synced 2024-12-02 08:33:20 +03:00
builder as prototype
This commit is contained in:
parent
84052deff9
commit
68dfd488c3
@ -9,10 +9,8 @@ data BankAccount = BankAccount {
|
|||||||
, interestRate :: Double
|
, interestRate :: Double
|
||||||
} deriving (Show)
|
} deriving (Show)
|
||||||
|
|
||||||
builder :: Int -> ((Int, String) -> (Int, String, String))
|
defaultAccount :: Int -> BankAccount
|
||||||
builder acc name = withName (acc, name)
|
defaultAccount i = BankAccount i "" "" 0 0
|
||||||
|
|
||||||
withName = undefined
|
|
||||||
|
|
||||||
builderDemo = do
|
builderDemo = do
|
||||||
putStrLn "Builder -> ???"
|
putStrLn "Builder -> ???"
|
||||||
@ -22,6 +20,10 @@ builderDemo = do
|
|||||||
, branch = "Reikjavik"
|
, branch = "Reikjavik"
|
||||||
, balance = 1000
|
, balance = 1000
|
||||||
, interestRate = 2.5
|
, interestRate = 2.5
|
||||||
}
|
}
|
||||||
putStrLn "build an account"
|
print acc1
|
||||||
print acc1
|
let acc2 = defaultAccount 4711
|
||||||
|
print acc2
|
||||||
|
let acc3 = acc2 {name="Hans Mejer", branch="London", balance=10000}
|
||||||
|
print acc3
|
||||||
|
|
Loading…
Reference in New Issue
Block a user