Type-level sets in Haskell / Agda -


i've seen in latest versions of ghc there's support type-level lists. however, need work type-level sets application, , implement type-level set library based on type-level lists. don't know start :(

is there library supporting type-level sets in haskell?

you can use hset property hlist's hlist package:

{-# language flexibleinstances #-}  import data.hlist  class (hlist l, hset l) => thisisset l   -- here have @l@ @hlist@ _and_ @hset@.   test :: l  -- ok:  instance thisisset hnil   test = hnil  -- , this:  instance thisisset (hcons hzero hnil)   test = hcons hzero hnil  -- , (hzero != hsucc hzero):  instance thisisset (hcons hzero (hcons (hsucc hzero) hnil))   test = hcons hzero (hcons (hsucc hzero) hnil)  -- error since hsucc hzero == hsucc hzero:  instance thisisset (hcons (hsucc hzero) (hcons (hsucc hzero) hnil))   test = hcons (hsucc hzero) (hcons (hsucc hzero) hnil) 

for working other types need write heq instances them.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -