Built-in type family with one input argument

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Built-in type family with one input argument

alice
Hello, I’ve made a built-in function that takes a list and returns a list: `type family MySet [k] -> [k]`. I think I did something wrong because right now I’m getting an exception like that:

```
Extracted [Int, Bool, Char] — input list 1
List_ty '[Bool, Char, Int] — sorted list 1
Extracted [Int, Bool, Char] — input list 2 (?)
List_ty '[Bool, Char, Int] — sorted list 2 (?)
ghc: panic! (the 'impossible' happened)
  (GHC version 8.4.2 for x86_64-apple-darwin):
ASSERT failed!
  Bad coercion hole co_a2QJ: MySet
                             '[Bool, Char, Int]
                             nominal
                             (MySet '[Int, Bool, Char] :: [*]) ~# ('[Bool, Char, Int] :: [*])
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1208:22 in ghc:Outputable
        assertPprPanic, called at compiler/typecheck/TcMType.hs:306:25 in ghc:TcMType
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
        pprPanic, called at compiler/utils/Outputable.hs:1206:5 in ghc:Outputable
        assertPprPanic, called at compiler/typecheck/TcMType.hs:306:25 in ghc:TcMType

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
```

when I’m trying to check the ~ relation:

```
test :: Proxy (GHC.TypeLits.MySet '[Int, Bool, Char]) -> Proxy (GHC.TypeLits.MySet '[Int, Bool, Char])
test = id
```

But when I do something like that:

```
test :: (GHC.TypeLits.MySet '[Int, Bool, Char] ~ as, GHC.TypeLits.MySet '[Int, Bool, Char] ~ bs) => Proxy as -> Proxy bs
test = id
```
everything is fine. 
I think the problem is that I tried to follow TcTypeNats#typeSymbolCmpTyCon etc style but all the functions there have two inputs and one output with built-in kind (I tried to do [k] kind by myself), so probably I understood something wrong.

Could someone give me a hint what I did wrong, please? I can show my code if needed.

Thank you for your time, 

Alice.

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs