Resources on how to implement (Haskell 98) kind checking?

2021-10-14 Thread Benjamin Redelings
Hi, I asked about this on Haskell-Cafe, and was recommended to ask here instead.  Any help is much appreciated! 1. I'm looking for resources that describe how to implement kind Haskell 98 checking.  Does anyone have any good suggestions?  So far, the papers that I've looked at all fall

Re: Output language of typechecking pass?

2021-12-28 Thread Benjamin Redelings
point simo...@microsoft.com <mailto:simo...@microsoft.com> will cease to work.  Use simon.peytonjo...@gmail.com <mailto:simon.peytonjo...@gmail.com> instead.  (For now, it just forwards to simo...@microsoft.com.) *From:*ghc-devs *On Behalf Of *Benjamin Redelings *Sent:*

Re: Output language of typechecking pass?

2021-11-08 Thread Benjamin Redelings
Hi, Questions: 1. It seems like this separation is actually necessary, in order to apply generalization only to let arguments written by the programmer, and not to let bindings introduced during desugaring. Is that right? I don't think so. That is, if we did it all in one pass, I still

Re: Resources on how to implement (Haskell 98) kind checking?

2021-10-27 Thread Benjamin Redelings
Hi Richard, Many thanks for the hints! On 10/15/21 1:37 PM, Richard Eisenberg wrote: I can see two ways to proceed: i) First determine the kinds of all the data types, classes, and type synonyms.  Then perform a second pass over each type or class to determine the kinds of type variables

Re: Resources on how to implement (Haskell 98) kind checking?

2021-10-27 Thread Benjamin Redelings
s paper), and maybe also to mention papers like the THIH paper that don't actually implement kind checking. -BenRI On 10/15/21 1:37 PM, Richard Eisenberg wrote: On Oct 14, 2021, at 11:59 AM, Benjamin Redelings wrote: I asked about this on Haskell-Cafe, and was recommended to ask here in

Output language of typechecking pass?

2021-10-27 Thread Benjamin Redelings
Hi,     I have been looking for info on what actually comes out of the type-checking pass in GHC.  This is mostly because it seems like the "Type classes in Haskell" paper implements both type checking and translation to dictionary-passing in one pass, whereas it seems like GHC separates

Question about ambiguous predicates in pattern bindings

2022-01-15 Thread Benjamin Redelings
Hi, 1. I'm reading "A Static semantics for Haskell" and trying to code it up.  I came across some odd behavior with pattern bindings, and I was wondering if someone could explain or point me in the right direction. Suppose you have the declaration     (x,y) = ('a',2) My current code is

Question about retaining / deferring /defaulting ambiguous predicates (was Question about ambiguous predicates in pattern bindings)

2022-01-18 Thread Benjamin Redelings
re my code is going wrong. -BenRI On 1/15/22 11:09 AM, Benjamin Redelings wrote: Hi, 1. I'm reading "A Static semantics for Haskell" and trying to code it up.  I came across some odd behavior with pattern bindings, and I was wondering if someone could explain or point me in the

Advice for implementing GADTs?

2022-07-29 Thread Benjamin Redelings
t be wrong about the last one... Thanks again, and sorry for the long e-mail. -BenRI On 1/18/22 8:55 PM, Benjamin Redelings wrote: Hi, 1. I think I have clarified my problem a bit.  It is actually not related to pattern bindings. Here's an example: h = let f c i = if i > 10 then c

Re: "Modularizing GHC" paper

2022-05-04 Thread Benjamin Redelings
This is a great paper!  The explanation of how DynFlags has wormed its way into more and more functions is quite interesting. I wonder if, in general, some developers lean away from refactoring and more towards "getting things done", whereas other developers lean into code refactoring and

Re: Advice for implementing GADTs?

2022-08-15 Thread Benjamin Redelings
Thanks for the references!  I will take a look. -BenRI On 8/4/22 9:22 PM, David Christiansen wrote: QUESTION 2: if my quick scan is correct, none of the papers mention the GHC technique of determining untouchability by assigning "levels" to type variables.  Is there any written

Re: Advice for implementing GADTs?

2022-08-15 Thread Benjamin Redelings
Thanks a bunch for this! On 8/4/22 3:45 PM, Simon Peyton Jones wrote: QUESTION 1: Are there any obviously important resources that I've overlooked? That's a good list.  Ningning's thesis https://xnning.github.io/ is also good stuff. Thanks! QUESTION 2: if my quick scan is correct, none

Re: GHC and type-family rewriting?

2022-12-17 Thread Benjamin Redelings
on" in support of the flattening idea. -BenRI On 12/8/22 11:48 PM, Richard Eisenberg wrote: On Nov 30, 2022, at 9:42 PM, Benjamin Redelings wrote: (Q1) Did GHC evolve to this point starting from something fairly close to the OutsideIn paper? Yes. (Q2) Is the new approach (i.e. eager t

GHC and type-family rewriting?

2022-11-30 Thread Benjamin Redelings
Hi, I've managed to code up implications and GADTs, and am now working on adding type families.  I've been following the OutsideIn paper, but it seems that GHC is not really following the same plan for the solver.  For example, instead of replacing every type family with a metavariable, it

NamedDefaults and relaxed defaults?

2023-07-26 Thread Benjamin Redelings
Hi, If I understand correctly, the traditional defaulting rules prevent defaulting variables with constraints like (Num a, Convertible a Double), but the NamedDefaults proposal would allow defaulting a ~ Double in this case due to the relaxed defaulting rules in section 2.5 of the proposal:

Re: NamedDefaults and relaxed defaults?

2023-07-26 Thread Benjamin Redelings
://gitlab.haskell.org/ghc/ghc/-/issues/20686 Simon On Wed, 26 Jul 2023 at 11:00, Benjamin Redelings wrote: Hi, If I understand correctly, the traditional defaulting rules prevent defaulting variables with constraints like (Num a, Convertible a Double), but the NamedDefaults

Re: NamedDefaults and relaxed defaults?

2023-07-26 Thread Benjamin Redelings
On 7/26/23 6:46 PM, Benjamin Redelings wrote: Thanks! It looks like ExtendedDefaultRules already allows default variables that co-occur with multiparameter constraints and non-standard classes.  So maybe that solves my issue with (Num a, Convertible a Double). It looks like (Num