homeomorphic-0.1: Data/Homeomorphic/Hash1.hs
{-# LANGUAGE CPP #-}
#define NAME Hash1
#include "Include/Hash.hs"
type Hash k = Set.Set (Int,k)
calcHash :: Ord k => Shell k -> Hash k
calcHash = f Set.empty
where f x (Shell a b c) = foldl' f (Set.insert (b,a) x) c
-- important: calculate the hash of y only once per invokation
checkHash :: Ord k => Shell k -> Hash k -> Bool
checkHash y = (`Set.isSubsetOf` calcHash y)