Building dictionary terms in Core?

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

Building dictionary terms in Core?

Ömer Sinan Ağacan
Hi,

In #15646 (recent discussion in Gitlab MR 55) we need dictionary arguments in
Core (in desugarer) to apply to functions like `fromRational :: Fractional a =>
Rational -> a`, but we don't know how to build the dictionary term (`Fractional
a`) in Core. Can anyone who know help us in the MR?

Thanks,

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

Re: Building dictionary terms in Core?

Oleg Grenrus
Hi Ömer,

I cannot answer you precisely, but when I was working on my type-checker
plugin, I used functions `classTyCon` and `tyConSingleDataCon`,
https://github.com/phadej/kleene-type/blob/cb7332b98ae229e162c12186fd4d7fccb06ab62f/plugin/KleenePlugin/TcPlugin.hs#L331-L336;
i.e. shouldn't be much different than constructing a record.

Hopefully those help you find out the right functions.

- Oleg

On 7.1.2019 8.56, Ömer Sinan Ağacan wrote:

> Hi,
>
> In #15646 (recent discussion in Gitlab MR 55) we need dictionary arguments in
> Core (in desugarer) to apply to functions like `fromRational :: Fractional a =>
> Rational -> a`, but we don't know how to build the dictionary term (`Fractional
> a`) in Core. Can anyone who know help us in the MR?
>
> Thanks,
>
> Ömer
> _______________________________________________
> 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

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Building dictionary terms in Core?

GHC - devs mailing list
In reply to this post by Ömer Sinan Ağacan
I'm on a train, so unable to dig deep.

The standard thing to do is to build the dictionary in the type checker, and leave it in the syntax tree for the desugarer to use.

The ticket and MR discussion have grown long.  Is there an up-do-date stand-alone description of the currently-proposed design than one can read instead of doing (foldr add-comments empty all-comments)?

Thanks

Simon

| -----Original Message-----
| From: ghc-devs <[hidden email]> On Behalf Of Ömer Sinan
| Agacan
| Sent: 07 January 2019 06:57
| To: ghc-devs <[hidden email]>
| Subject: Building dictionary terms in Core?
|
| Hi,
|
| In #15646 (recent discussion in Gitlab MR 55) we need dictionary arguments
| in
| Core (in desugarer) to apply to functions like `fromRational :: Fractional
| a =>
| Rational -> a`, but we don't know how to build the dictionary term
| (`Fractional
| a`) in Core. Can anyone who know help us in the MR?
|
| Thanks,
|
| Ömer
| _______________________________________________
| 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