Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,11 @@
foobar = 15
f x = x + foobar
where foobar = 15
f x = let foobar = 15
in x + foobar
f x = do
let foobar = 15
return $ x + foobar

View file

@ -0,0 +1,7 @@
main = do
s <- getLine
print (s, s)
-- The above is equivalent to:
main = getLine >>= \s -> print (s, s)

View file

@ -0,0 +1,4 @@
funkshun True x = x + 1
funkshun False x = x - 1
foobar = funkshun True 5 + funkshun False 5 -- 6 + 4

View file

@ -0,0 +1,4 @@
funkshun m = case foo m of
[a, b] -> a - b
a : b : c : rest -> a + b - c + sum rest
a -> sum a

View file

@ -0,0 +1,3 @@
signum x | x > 0 = 1
| x < 0 = -1
| otherwise = 0

View file

@ -0,0 +1,10 @@
dotProduct :: [Int] -> [Int] -> Int
dotProduct ns ms = sum $ zipWith (+) ns ms
-- Without the type signature, dotProduct would
-- have a more general type.
foobar :: Num a => a
foobar = 15
-- Without the type signature, the monomorphism
-- restriction would cause foobar to have a less
-- general type.