Skip to content

Instantly share code, notes, and snippets.

View aochagavia's full-sized avatar

Adolfo Ochagavía aochagavia

View GitHub Profile
@edwinb
edwinb / divide.idr
Created July 2, 2014 09:44
Type safe division
module Main
{- Divide x by y, as long as there is a proof that y is non-zero. The
'auto' keyword on the 'p' argument means that when safe_div is called,
Idris will search for a proof. Either y will be statically known, in
which case this is easy, otherwise there must be a proof in the context.
'so : Bool -> Type' is a predicate on booleans which only holds if the
boolean is true. Essentially, we are making it a requirement in the type
that a necessary dynamic type is done before we call the function -}
@emberian
emberian / links.md
Last active August 29, 2015 13:57
PL Theory etc