8.2.1: Ord TyCon is gone?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

8.2.1: Ord TyCon is gone?

Levent Erkok
I'm trying to port some plugin code from GHC 8.0.2 to GHC 8.2.1; alas I'm getting an error suggesting that TyCon is no longer an instance of Ord:

Data/SBV/Plugin/Analyze.hs:580:33: error:
    • No instance for (Ord TyCon) arising from a use of ‘M.lookup’
      There are instances for similar types:
        instance Ord GHC.Types.TyCon -- Defined in ‘GHC.Classes’
    • In the expression: k `M.lookup` tcMap
      In the expression:
        case k `M.lookup` tcMap of
          Just knd -> return knd
          Nothing -> unknown
      In a case alternative:
          Just k
            -> case k `M.lookup` tcMap of
                 Just knd -> return knd
                 Nothing -> unknown
    |
580 |                  Just k -> case k `M.lookup` tcMap of
    |                                 ^^^^^^^^^^^^^^^^^^

I was using TyCon's as a key in a map, but that code is no longer compiling. I've looked through the release notes but couldn't find what the new mechanism is.

I'd appreciate if someone can point me in the right direction regarding how to use TyCon as a map key..

Thanks,

-Levent.

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 8.2.1: Ord TyCon is gone?

Niklas Hambüchen
Hi Levent,

that seems to be this commit, part of the making-ghc-deterministic effort:

  https://ghc.haskell.org/trac/ghc/ticket/4012#comment:213

CC @niteria who might be answer your question.

Niklas

On 29/07/17 08:12, Levent Erkok wrote:
> I'm trying to port some plugin code from GHC 8.0.2 to GHC 8.2.1; alas
> I'm getting an error suggesting that TyCon is no longer an instance of
Ord:

>
> Data/SBV/Plugin/Analyze.hs:580:33: error:
>     • No instance for (Ord TyCon) arising from a use of ‘M.lookup’
>       There are instances for similar types:
>         instance Ord GHC.Types.TyCon -- Defined in ‘GHC.Classes’
>     • In the expression: k `M.lookup` tcMap
>       In the expression:
>         case k `M.lookup` tcMap of
>           Just knd -> return knd
>           Nothing -> unknown
>       In a case alternative:
>           Just k
>             -> case k `M.lookup` tcMap of
>                  Just knd -> return knd
>                  Nothing -> unknown
>     |
> 580 |                  Just k -> case k `M.lookup` tcMap of
>     |                                 ^^^^^^^^^^^^^^^^^^
>
> I was using TyCon's as a key in a map, but that code is no longer
> compiling. I've looked through the release notes but couldn't find what
> the new mechanism is.
>
> I'd appreciate if someone can point me in the right direction regarding
> how to use TyCon as a map key..
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 8.2.1: Ord TyCon is gone?

Benno Fünfstück
Hi,


Regards,
Benno

Hi Levent,

that seems to be this commit, part of the making-ghc-deterministic effort:

  https://ghc.haskell.org/trac/ghc/ticket/4012#comment:213

CC @niteria who might be answer your question.

Niklas

On 29/07/17 08:12, Levent Erkok wrote:
> I'm trying to port some plugin code from GHC 8.0.2 to GHC 8.2.1; alas
> I'm getting an error suggesting that TyCon is no longer an instance of
Ord:
>
> Data/SBV/Plugin/Analyze.hs:580:33: error:
>     • No instance for (Ord TyCon) arising from a use of ‘M.lookup’
>       There are instances for similar types:
>         instance Ord GHC.Types.TyCon -- Defined in ‘GHC.Classes’
>     • In the expression: k `M.lookup` tcMap
>       In the expression:
>         case k `M.lookup` tcMap of
>           Just knd -> return knd
>           Nothing -> unknown
>       In a case alternative:
>           Just k
>             -> case k `M.lookup` tcMap of
>                  Just knd -> return knd
>                  Nothing -> unknown
>     |
> 580 |                  Just k -> case k `M.lookup` tcMap of
>     |                                 ^^^^^^^^^^^^^^^^^^
>
> I was using TyCon's as a key in a map, but that code is no longer
> compiling. I've looked through the release notes but couldn't find what
> the new mechanism is.
>
> I'd appreciate if someone can point me in the right direction regarding
> how to use TyCon as a map key..
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 8.2.1: Ord TyCon is gone?

Ben Gamari-2
In reply to this post by Levent Erkok
Levent Erkok <[hidden email]> writes:

> I'm trying to port some plugin code from GHC 8.0.2 to GHC 8.2.1; alas I'm
> getting an error suggesting that TyCon is no longer an instance of Ord:
>
> Data/SBV/Plugin/Analyze.hs:580:33: error:
>     • No instance for (Ord TyCon) arising from a use of ‘M.lookup’
>       There are instances for similar types:
>         instance Ord GHC.Types.TyCon -- Defined in ‘GHC.Classes’
>     • In the expression: k `M.lookup` tcMap
>       In the expression:
>         case k `M.lookup` tcMap of
>           Just knd -> return knd
>           Nothing -> unknown
>       In a case alternative:
>           Just k
>             -> case k `M.lookup` tcMap of
>                  Just knd -> return knd
>                  Nothing -> unknown
>     |
> 580 |                  Just k -> case k `M.lookup` tcMap of
>     |                                 ^^^^^^^^^^^^^^^^^^
>
Hmm. I am unable to reproduce this,

    $ ghci
    λ> import Type.Reflection
    λ> let tc = typeRepTyCon (typeRep @Int)
    λ> tc == tc
    True

Does that work for you?

Cheers,

- Ben

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

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 8.2.1: Ord TyCon is gone?

Brandon Allbery
On Sat, Jul 29, 2017 at 10:07 AM, Ben Gamari <[hidden email]> wrote:
Hmm. I am unable to reproduce this,

    $ ghci
    λ> import Type.Reflection
    λ> let tc = typeRepTyCon (typeRep @Int)
    λ> tc == tc
    True

Does that work for you?

Maybe I'm missing something, but doesn't that only test Eq, not Ord?

--
brandon s allbery kf8nh                               sine nomine associates
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 8.2.1: Ord TyCon is gone?

Ben Gamari-2
Brandon Allbery <[hidden email]> writes:

> On Sat, Jul 29, 2017 at 10:07 AM, Ben Gamari <[hidden email]> wrote:
>
>> Hmm. I am unable to reproduce this,
>>
>>     $ ghci
>>     λ> import Type.Reflection
>>     λ> let tc = typeRepTyCon (typeRep @Int)
>>     λ> tc == tc
>>     True
>>
>> Does that work for you?
>>
>
> Maybe I'm missing something, but doesn't that only test Eq, not Ord?
>
Oh dear, I somehow understood that you were referring to Typeable's
TyCon, not the ghc library's TyCon. Ignore my message.

Indeed the TyCon Ord instance is gone to help enforce determinism within
GHC. If you need a map use UniqFM.

Cheers,

- Ben

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

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 8.2.1: Ord TyCon is gone?

Levent Erkok
Thanks!

Turns out I actually needed an `Ord` instance for `(TyCon, [TyCon])`, which made using `UniqFM` rather difficult, but it wasn't hard to work around the issue by using nonDetCmpUnique function from the `Unique` module. For a side project, I think it's good enough..

Cheers,

-Levent.

On Sat, Jul 29, 2017 at 9:06 AM, Ben Gamari <[hidden email]> wrote:
Brandon Allbery <[hidden email]> writes:

> On Sat, Jul 29, 2017 at 10:07 AM, Ben Gamari <[hidden email]> wrote:
>
>> Hmm. I am unable to reproduce this,
>>
>>     $ ghci
>>     λ> import Type.Reflection
>>     λ> let tc = typeRepTyCon (typeRep @Int)
>>     λ> tc == tc
>>     True
>>
>> Does that work for you?
>>
>
> Maybe I'm missing something, but doesn't that only test Eq, not Ord?
>
Oh dear, I somehow understood that you were referring to Typeable's
TyCon, not the ghc library's TyCon. Ignore my message.

Indeed the TyCon Ord instance is gone to help enforce determinism within
GHC. If you need a map use UniqFM.

Cheers,

- Ben

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



_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 8.2.1: Ord TyCon is gone?

Edward Z. Yang
In reply to this post by Levent Erkok
Sorry about being late to the conversation, but if you need a map
from Type to something, go look at TypeMap in the TrieMap module.

Edward

Excerpts from Levent Erkok's message of 2017-07-28 23:12:32 -0700:

> I'm trying to port some plugin code from GHC 8.0.2 to GHC 8.2.1; alas I'm
> getting an error suggesting that TyCon is no longer an instance of Ord:
>
> Data/SBV/Plugin/Analyze.hs:580:33: error:
>     • No instance for (Ord TyCon) arising from a use of ‘M.lookup’
>       There are instances for similar types:
>         instance Ord GHC.Types.TyCon -- Defined in ‘GHC.Classes’
>     • In the expression: k `M.lookup` tcMap
>       In the expression:
>         case k `M.lookup` tcMap of
>           Just knd -> return knd
>           Nothing -> unknown
>       In a case alternative:
>           Just k
>             -> case k `M.lookup` tcMap of
>                  Just knd -> return knd
>                  Nothing -> unknown
>     |
> 580 |                  Just k -> case k `M.lookup` tcMap of
>     |                                 ^^^^^^^^^^^^^^^^^^
>
> I was using TyCon's as a key in a map, but that code is no longer
> compiling. I've looked through the release notes but couldn't find what the
> new mechanism is.
>
> I'd appreciate if someone can point me in the right direction regarding how
> to use TyCon as a map key..
>
> Thanks,
>
> -Levent.
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Loading...