notjack
2017-10-1 00:57:42

@lexi.lambda finally getting around to watching Inside Hackett!


notjack
2017-10-1 00:58:03

I noticed the type checker structs are all prefab, I assume that is because of cross-phase uses?


notjack
2017-10-1 01:00:11

I had a problem once where I wanted cross-phase structs but didn’t want them to be prefab so I could attach properties to them still (like custom write) and a method that ryan suggested was to declare a struct property in a cross phase persistent module and use that property in functions that I wanted to use in a cross-phase manner. Is that something you’d be interested in for those structs or is their prefab-ness not a problem?


lexi.lambda
2017-10-1 01:14:23

@notjack I don’t think there’s any reason at the moment to make them non-prefab, but I could imagine a couple different ways to support that if it became necessary at some point.


notjack
2017-10-1 01:14:56

gotcha


notjack
2017-10-1 01:18:29

@lexi.lambda the transformation of a let to a lambda then back to a let - what problems come up if the lambda->racket-let step isn’t done and you just leave it as a lambda? is it for optimization reasons or something else?


lexi.lambda
2017-10-1 01:19:52

you mean implementing let in terms of lambda? you could do that for let, specifically, but not for things like letrec or more complicated forms.


notjack
2017-10-1 01:20:11

yeah I mean just for let specifically, no idea how to handle letrec


notjack
2017-10-1 01:20:21

also is this the paper you were working off of? https://people.mpi-sws.org/~joshua/bitype.pdf


lexi.lambda
2017-10-1 01:20:40

no, the paper is linked in the wiki page.


notjack
2017-10-1 01:20:43

gotta make sure I add the right thing to the reading list :P



lexi.lambda
2017-10-1 01:21:05

notjack
2017-10-1 01:21:17

ah I missed the wiki page, thanks


notjack
2017-10-1 01:46:17

@lexi.lambda Possible idea for the part of the hackett implementation that inserts @%dictionary-placeholder and then later performs a second expansion pass to insert the right dictionaries: what about using syntax-local-lift-expression and local-expand/capture-lifts? My thinking is that typeclass uses can use syntax-local-lift-expression to get an identifier for the dictionary they want and put their use-case-specific constraints in the lifted expression, then #%module-begin can call local expand, capture the lifted expressions, and manipulate the expressions to include the proper typeclass dictionary info based on the constraints in the lifted expressions. Do you think something like that could work?


notjack
2017-10-1 01:46:50

and do you think it would be simpler than what hackett does currently


lexi.lambda
2017-10-1 01:52:05

@notjack I don’t think that would work due to the way dictionary elaboration needs to consult local information introduced by @%with-dictionary.


notjack
2017-10-1 01:52:41

@lexi.lambda what local information does dictionary elaboration need?


lexi.lambda
2017-10-1 01:53:13

It needs (1) a fully solved type environment and (2) the set of constraints locally in scope.


lexi.lambda
2017-10-1 01:53:31

The latter equivalently being the set of dictionaries in scope.


lexi.lambda
2017-10-1 01:54:36

More generally, my long-term goal is to make the constraint solver extensible, so that things like type equalities, typeclasses, implicit parameters, checked exceptions, and units of measure can all be implemented separately from the core.


lexi.lambda
2017-10-1 01:54:51

(And they can be mixed and matched.)


notjack
2017-10-1 01:55:40

for things that are whole-program transformations, I’d expect the way to implement that would have to be as a #lang on top of hackett with the transformation implemented in #%module-begin somehow


notjack
2017-10-1 01:55:53

did you have something different in mind?


lexi.lambda
2017-10-1 01:56:00

bluntly, yes.


lexi.lambda
2017-10-1 01:56:52

it’s not an unrestricted transformation, but I think the typechecker can provide hooks that allow the constraint domain to be extended in ways that add new source-to-source transformations, yet don’t sacrifice composition.


notjack
2017-10-1 01:57:05

maybe something where hackett exposes lots of syntax parameters that influence how constraints are solved in a set of expressions?


lexi.lambda
2017-10-1 01:57:42

I think it would be somewhat orthogonal to existing Racket metaprogramming constructs


notjack
2017-10-1 01:59:00

interesting. in what ways? also, wild shot in the dark sort of question: do you think rosette or anything in its internals could be used in hackett’s implementation of constraint solving?


lexi.lambda
2017-10-1 01:59:49

the idea behind much of hackett is using the typechecker as a way to propagate compile-time information that can then be used for metaprogramming. this is they key idea behind why I think hackett can, theoretically, do more than either racket or haskell.


lexi.lambda
2017-10-1 01:59:56

(wrt metaprogramming, that is.)


notjack
2017-10-1 02:00:04

right, no complaints with that here


lexi.lambda
2017-10-1 02:00:15

I will touch upon that in some degree in my racketcon talk


lexi.lambda
2017-10-1 02:01:03

as for rosette: I don’t know, but I doubt it.


lexi.lambda
2017-10-1 02:02:44

they both use things called “constraint solvers”, but the sort of constraint solver used in haskell is a very different constraint solver from the one used in rosette. I am not sure the similarities extend beyond names.


notjack
2017-10-1 02:03:34

if i wanted to write a liquid-hackett sort of thing that needed access to an SMT solver, rosette seems like something I’d poke at since it’s supposed to be for making langs that use SMT solvers to do stuff


notjack
2017-10-1 02:03:50

but maybe for non-liquid-hackett it wouldn’t be useful at all


lexi.lambda
2017-10-1 02:04:19

right, if you wanted to add the notion of refinements to hackett’s constraint domain, that might be useful. but the point is more that hackett ought to be agnostic to the constraint domain.


lexi.lambda
2017-10-1 02:04:33

like HM(X) and OutsideIn(X) are parameterized over the constraint domain.


notjack
2017-10-1 02:05:34

so it’d be more like hackett provides some sort of syntactic protocol for macros to declare, require, and influence constraints independent of what constraints actually are or how they’re checked


notjack
2017-10-1 02:05:51

non-local constraints particularly


lexi.lambda
2017-10-1 02:05:57

right. and one of the nice properties of the Haskell type system is that’s actually possible.


notjack
2017-10-1 02:06:21

?


lexi.lambda
2017-10-1 02:06:38

OutsideIn(X) provides an especially strong framework with an extensible constraint domain, but Hackett’s typechecker isn’t nearly as fancy as OutsideIn at the moment.


notjack
2017-10-1 02:07:19

are HM(X) and OutsideIn(X) things in haskell’s internals that are exposed to language extensions?


lexi.lambda
2017-10-1 02:07:20

but the fact that OusideIn works like that is encouraging, since it means Hackett can continue to be generalized even if it makes an extensible constraint domain a core, user-accessible feature.


notjack
2017-10-1 02:07:36

I write very little haskell :p


lexi.lambda
2017-10-1 02:07:55

I think GHC typechecker plugins can add new sorts of constraint solvers, but I don’t believe they can add new constraints.


lexi.lambda
2017-10-1 02:08:45

OutsideIn(X) is the type system that GHC currently uses, though, for context.


notjack
2017-10-1 02:08:47

notjack
2017-10-1 02:09:31

then is HM(X) a constraint domain agnostic type system that ghc used to use but doesn’t anymore?


notjack
2017-10-1 02:09:55

for hindley milner I’m guessing :p


lexi.lambda
2017-10-1 02:10:39

I don’t believe GHC ever used HM(X)


notjack
2017-10-1 02:12:11

notjack
2017-10-1 02:12:17

is there anything else worth reading about it for context?


lexi.lambda
2017-10-1 02:12:54

I haven’t read that much about HM(X), since I’ve mostly focused on OutsideIn(X).


lexi.lambda
2017-10-1 02:13:09

before OutsideIn, I believe GHC used a system known as “boxy type inference”


notjack
2017-10-1 02:13:15

cute name


lexi.lambda
2017-10-1 02:14:10

Hackett uses neither, since it uses a variant on Dunfield and Krishnaswami’s bidirectional system that’s similar to the PureScript typechecker


lexi.lambda
2017-10-1 02:15:59

OutsideIn is very, very complex, but I think that’s largely because it’s designed to support type families, higher-rank polymorphism, and GADTs.


lexi.lambda
2017-10-1 02:16:15

Hackett currently only supports one of those things.


notjack
2017-10-1 02:19:11

lots to think about


notjack
2017-10-1 02:19:20

thanks for entertaining my questions :P


notjack
2017-10-1 02:19:27

really looking forward to the racketcon talk


lexi.lambda
2017-10-1 02:20:46

a lot of this stuff is, of course, aspirational. I don’t yet know if all of it is even possible, and even if it is, I think it’d be new research.


notjack
2017-10-1 02:20:59

the best kind of research


lexi.lambda
2017-10-1 02:21:19

well, the only kind of research, I think.


lexi.lambda
2017-10-1 02:21:52

if you know it’ll work, it isn’t really research, is it? :)


notjack
2017-10-1 02:22:14

that would be the joke :p


lexi.lambda
2017-10-1 02:24:29

in the past six months or so that I’ve been developing Hackett in earnest, I’ve developed some intuitions for certain things, so I think the ideas I have are possible, but I’m not 100% sure.


notjack
2017-10-1 02:26:11

heh I still want to figure out how #lang hackett/script with submodules could work for writing main and test submodules, and also pull the infix op code out into a package so I can use it for other stuff


lexi.lambda
2017-10-1 02:27:05

I thought about extracting the infix stuff, but it’s seriously like a couple dozen lines of code, and the interface isn’t stable enough for those couple dozen lines to be put in a package


lexi.lambda
2017-10-1 02:27:51

plus, there are advantages to keeping Hackett monolithic right now.


notjack
2017-10-1 02:28:36

not having to deal with racket’s package system and versioning is one that comes to mind


lexi.lambda
2017-10-1 02:29:39

that’s part of it, but a larger part is that I can worry about implementing exactly what Hackett needs and nothing more.


notjack
2017-10-1 02:29:55

true


notjack
2017-10-1 02:29:58

helps keep focus


lexi.lambda
2017-10-1 02:30:37

Hackett is, by LOC, extremely small.


lexi.lambda
2017-10-1 02:31:32

hackett-lib is a mere 3047 LOC


notjack
2017-10-1 02:31:46

heh, racket is amazing


notjack
2017-10-1 02:31:55

hypothetically, if there was a package that implemented infix app syntax in such a way that hackett could use it, do you think using it would be a bad idea?


lexi.lambda
2017-10-1 02:32:41

as of right now, probably. I think the time at which it might make sense to extract is once precedence is squared away, and that means we need to learn more about usage patterns for infix operators in real Hackett code.


notjack
2017-10-1 02:33:13

seems reasonable enough to me


jburgess84
2017-10-1 04:13:48

@jburgess84 has joined the channel