hinze-streams-1.0: Data/Stream/Hinze/Memo.hs
{-# LANGUAGE MultiParamTypeClasses #-}
module Data.Stream.Hinze.Memo where
import Prelude (id)
-- | We could add functional dependencies |k -> t| and |t -> k|, but since
-- Haskell has a nominal type system there may be several isomorphic key
-- types that relate to the same table type (or vice versa).
--
class Memo k t where
tabulate :: (k -> a) -> t a
lookup :: t a -> (k -> a)
dom :: t k
dom = tabulate id