Created
July 30, 2022 20:34
-
-
Save onosendi/75a3d9b55c5edf5f69c6d66c5f259f3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- data Name = Constructor1 <args> | Constructor2 <args> | |
data Calculation | |
= Add Int Int | |
| Sub Int Int | |
calc :: Calculation -> Int | |
calc (Add x y) = x + y | |
calc (Sub x y) = x - y | |
-- * Main> calc 1 1 | |
-- <interactive>:76:1: error: | |
-- • Couldn't match expected type ‘t0 -> t’ with actual type ‘Int’ | |
-- • The function ‘calc’ is applied to two arguments, | |
-- but its type ‘Calculation -> Int’ has only one | |
-- In the expression: calc 1 1 | |
-- In an equation for ‘it’: it = calc 1 1 | |
-- • Relevant bindings include it :: t (bound at <interactive>:76:1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment