diff options
author | Camil Staps | 2017-12-11 14:40:48 +0100 |
---|---|---|
committer | Camil Staps | 2017-12-11 14:42:07 +0100 |
commit | f4784a9f4ce7b1a9cb6b0898a191c870f640243f (patch) | |
tree | 902e7971f50a63e395439377d51b0ef7a2f318b1 /assignment-12/cashModel.dcl | |
parent | Student numbers (diff) |
Template assignment 12
Diffstat (limited to 'assignment-12/cashModel.dcl')
-rw-r--r-- | assignment-12/cashModel.dcl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/assignment-12/cashModel.dcl b/assignment-12/cashModel.dcl new file mode 100644 index 0000000..6d1b452 --- /dev/null +++ b/assignment-12/cashModel.dcl @@ -0,0 +1,26 @@ +definition module cashModel +/* + Pieter Koopman, Radboud University, 2017 + pieter@cs.ru.nl + Advanced programming + + A simple state model for an automated cash register +*/ + +import StdEnv, GenEq + +:: Euro = {euro :: Int, cent :: Int} +:: Product = Pizza | Beer | Cola +:: Action = Add Product | Rem Product | Pay + +class euro a :: a -> Euro +instance euro Product, Euro +instance euro Int, (Int, Int), [e] | euro e +instance + Euro +instance - Euro +instance zero Euro +derive gEq Euro +instance ~ Euro +instance == Euro, Product + +model :: [Product] Action -> ([Product],[Euro]) |