I’m not sure what the best way to do this is, but I think it would be nice if we could have a “dynamic” version of the type checker that can be used in situations like this.
Discription
Something like:
type family Foo (x :: * -> *) :: * where Foo Int = Bool Foo Char = String foo1 :: forall x . Foo x => x -> Bool foo1 i = case cast i of { Int -> True ; _ -> False } — ^ This works because `Foo` has been declared as an instance of `Functor` foo2 :: forall x
https://t.co/bQPJYtfHZ7
References
Back to Main