These are my notes on the lectures on the topic of Monads imparted by Irfan Ali between May 27 and June 7, 2022.
- Motivating example
- The Monad class
- List monad
- State monad
{"valueParameterInfo":[],"timeParameterDescriptions":[],"roleDescriptions":[],"contractType":"Other","contractShortDescription":"Unknown","contractName":"Unknown","contractLongDescription":"We couldn't find information about this contract","choiceInfo":[]} |
{"valueParameterInfo":[],"timeParameterDescriptions":[],"roleDescriptions":[],"contractType":"Other","contractShortDescription":"Unknown","contractName":"Unknown","contractLongDescription":"We couldn't find information about this contract","choiceInfo":[]} |
{"valueParameterInfo":[],"timeParameterDescriptions":[],"roleDescriptions":[],"contractType":"Other","contractShortDescription":"Unknown","contractName":"Unknown","contractLongDescription":"We couldn't find information about this contract","choiceInfo":[]} |
These are my notes on the lectures on the topic of Monads imparted by Irfan Ali between May 27 and June 7, 2022.
{-# LANGUAGE OverloadedStrings #-} | |
module Example where | |
import Language.Marlowe.Extended | |
np = 3 :: Integer -- Number of payments (positive integer) | |
am = 50 :: Integer -- Amount (in Ada) of each deposit by Client (positive integer) | |
main :: IO () | |
main = printJSON $ contract np am (TimeParam "Bank Deadline") (TimeParam "Client Deadline") |
{"valueParameterInfo":[["Amount",{"valueParameterFormat":{"contents":[6,"ada"],"tag":"DecimalFormat"},"valueParameterDescription":"Deposit amount"}]],"timeParameterDescriptions":[],"roleDescriptions":[],"contractType":"Other","contractShortDescription":"Bank conditionally rewards Client for all deposits","contractName":"Bank & Client","contractLongDescription":"Bank conditionally rewards Client for all deposits, penalizes if at least one deposit is missing","choiceInfo":[]} |
{"valueParameterInfo":[["Deposit",{"valueParameterFormat":{"contents":[6,"ada"],"tag":"DecimalFormat"},"valueParameterDescription":"Amount of deposit by each payer"}]],"timeParameterDescriptions":[],"roleDescriptions":[],"contractType":"Other","contractShortDescription":"Multiple Payers give to Receiver","contractName":"Multi Pay","contractLongDescription":"Multiple Payers give to Receiver","choiceInfo":[]} |
{-# LANGUAGE OverloadedStrings #-} | |
module Example where | |
import Language.Marlowe.Extended | |
main :: IO () | |
main = printJSON $ contract (Role "Giver1") (Role "Giver2") (Role "Receiver") (ConstantParam "Deposit") (TimeParam "Deadline") | |
contract :: Party -> Party -> Party -> Value -> Timeout -> Contract | |
contract giver1 giver2 receiver amount deadline = |
{"valueParameterInfo":[["Deposit",{"valueParameterFormat":{"contents":[6,"ada"],"tag":"DecimalFormat"},"valueParameterDescription":"Deposit by each giver"}]],"timeParameterDescriptions":[],"roleDescriptions":[],"contractType":"Other","contractShortDescription":"Two givers pay to one recipient","contractName":"Double Pay (Blockly)","contractLongDescription":"Two givers pay to one recipient","choiceInfo":[]} |
{"valueParameterInfo":[],"timeParameterDescriptions":[],"roleDescriptions":[],"contractType":"Other","contractShortDescription":"Unknown","contractName":"Unknown","contractLongDescription":"We couldn't find information about this contract","choiceInfo":[]} |