Safe HaskellSafe

S06

Contents

Description

Solutions to Exercises for December 7, 2018

Synopsis

Exercises 2

safeTail :: [a] -> Maybe [a] Source #

Safe versions of tail and init.

safeInit :: [a] -> Maybe [a] Source #

Safe versions of tail and init.

safeLast :: [a] -> Maybe a Source #

Safe version of last.

Exericse 3

Exericse 4

root :: Term -> Maybe Term Source #

Perform a single beta-step at the root.

isWHNF :: Term -> Bool Source #

Check whether a given term is in weak head normal form.

cbn :: Term -> Maybe Term Source #

Single-step call by name reduction.

Exercise 5

equals :: Ord a => Set a -> Set a -> Bool Source #

Test whether two given Sets are qual.

Exercise 6

Orphan instances

Ord a => Eq (Set a) # 

Methods

(==) :: Set a -> Set a -> Bool #

(/=) :: Set a -> Set a -> Bool #