MemoTrie icon indicating copy to clipboard operation
MemoTrie copied to clipboard

Making it work with Enum?

Open nh2 opened this issue 11 years ago • 2 comments

Hey,

it would be nice if MemoTrie could handle Enums.

An instance Enum a => HasTrie a would probably be overlapping, but maybe a newtype or custom function can make it convenient enough.

nh2 avatar Nov 25 '13 01:11 nh2

Thanks for the suggestion. Any thoughts on how to define such an instance?

conal avatar Nov 25 '13 16:11 conal

It might be nice to approach this in the same way you approach using GHC.Generics to implement instances. Some definitions for trieEnum, untrieEnum, and enumerateEnum could be provided. Instances would then use newtype a :-> b = SomeTrie (Int :-> b)

glguy avatar Nov 26 '16 03:11 glguy