0size returns positive valuesavghead and tail are Safeaveragemapinitinit'insertLists ElementsListkeysMapevalcreate : Allocate and Fill a ByteStringunsafeTake : Extract prefix of size nunpack : Convert ByteString into List of Char
Lets define our own List data type:
Measure
Haskell function with a single equation per constructor
Measure
Strengthens type of data constructor
data List a where
Emp :: {v:List a | length v = 0}
(:::) :: x:a -> xs:List a
-> {v:List a | length v = 1 + length xs}
Fear head and tail no more!
Q: Write types for head and tail that verify impossible.
A convenient type alias
Fold or Reduce f over any list using seed acc
Fold or Reduce f over non-empty list using first element as seed
averageQ: What is a safe input type for average'?
Make illegal states unrepresentable
Legal Values: Lists of 12 elements, e.g.
"jan" ::: "feb" ::: ... ::: "dec" ::: Emp"
Refine Type to Legal Values
Lists Of A Given Size
Make illegal states unrepresentable
mapQ: Can you fix map to verify tempAverage?
initQ: Can you fix the type of init so that sanDiegoTemp is accepted?
init'Q: For bonus points, fix init' so sanDiegoTemp'is accepted?
Next: Case Studies