Skip to content

Instantly share code, notes, and snippets.

View heather-alexander's full-sized avatar

Heather Alexander heather-alexander

View GitHub Profile

Keybase proof

I hereby claim:

  • I am heather-alexander on github.
  • I am ericadalbassa (https://keybase.io/ericadalbassa) on keybase.
  • I have a public key ASBqksDMgae7EwbonvPUx2LEHWvIy6JvduohTLsB7QAnHQo

To claim this, I am signing this object:

@heather-alexander
heather-alexander / finiteMap.hs
Created April 9, 2014 04:34
Finite map with functional dependencies
{-# LANGUAGE FunctionalDependencies, FlexibleInstances #-}
import Data.Maybe (fromJust, isJust)
-- Finite map class suggested in "Type Classes with Functional Dependencies" (Mark Philip Jones, 2000).
class FiniteMap i e fm | fm -> i e where
emptyFM :: fm
look :: i -> fm -> Maybe e
extend :: i -> e -> fm -> fm