Menu

1 / 2

Haskell Review · 2026-10-13

DEV Community: haskell·이관호(Gwanho LEE)·5 days ago
#DYvHYA3v
#devtohaskell#devto#dev#true#maybe
Reading 0:00
15s threshold

Types and values: True :: Bool , Just 7 :: Maybe Int . Bool and Maybe Int are types; True and Just 7 are values.

Functions and calls: double :: Integer -> Integer , double 3 :: Integer . Define quadrupling as quadruple x = double (double x) .

Pattern matching: isZero :: Integer -> Bool . Define cases with isZero 0 = True and isZero _ = False .

Recursion: sumTo 0 = 0 , sumTo n = n + sumTo (n - 1) . Reduce the input until reaching the base case.

Type variables: a stands for a type. head :: [a] -> a returns one element; tail :: [a] -> [a] returns the remaining list.

With numbers specialized to Int :

head [ True , False ] -- True :: Bool tail [ True , False ] -- [False] :: [Bool] head [[ 1 , 2 ], [ 3 , 4 ]] -- [1, 2] :: [Int] tail [[ 1 , 2 ], [ 3 , 4 ]] -- [[3, 4]] :: [[Int]]

Enter fullscreen mode

Exit fullscreen mode

Connection to earlier lessons: for Maybe , pure wraps a value in Just ; fmap applies an ordinary function, and <*> applies a wrapped function.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.