purescript / purescript-typelevel-prelude

Types and kinds for basic type-level programming
BSD 3-Clause "New" or "Revised" License
63 stars 21 forks source link

typeclass instances for proxies #32

Closed matthewleon closed 3 years ago

matthewleon commented 6 years ago

These are copied from the instances for Proxy.

matthewleon commented 6 years ago

I'm using an Eq instance here: https://github.com/matthewleon/purescript-nat-kind/blob/master/test/Main.purs

It's a fork of another library, along with its test suite, so there might be a better way to do this. But I think these instances make sense.

LiamGoodacre commented 6 years ago

I'm happy for these to be added. But for your test: isn't it only about if they type check (i.e, before the test even runs), so you could do something like:

typeEqual :: forall e a. a -> a -> Test e
typeEqual _ _ = success

tests = do
  suite "trich" do
    test "2 < 3" do
      typeEqual (OProxy :: OProxy LT) $ trich d2 d3
matthewleon commented 6 years ago

Yes, I think you're absolutely right. I realized that as I wrote the PR... But felt the instances do make sense regardless.

kl0tl commented 3 years ago

We‘ve deprecated the monomorphic proxies in favor of Type.Proxy.Proxy, which we’ll be polymorphic in v0.14, I think we should close this.