aymano.osman
2020-9-2 10:35:54

Question for those using web-server, do you have some way of auto-reloading code whilst developing? Or do you have some other workflow which you like?


sorawee
2020-9-2 10:41:30

aymano.osman
2020-9-2 11:27:06

Thanks! Will check it out.


popa.bogdanp
2020-9-2 15:39:34

koyo watches the filesystem and restarts the server as needed, but it’s kind of slow. I ran into a number of problems with the reloadable approach in the past (some details https://github.com/Bogdanp/koyo/issues/19\|here).


popa.bogdanp
2020-9-2 15:41:43

The runner is https://github.com/Bogdanp/koyo/blob/11698c92463acb0a839409a1c38967d33f209e1f/koyo-lib/koyo/runner.rkt\|here and should be fairly easy to adapt to another project if you want to give that approach a try.


aymano.osman
2020-9-2 16:25:46

Cheers. I’ll take a look at that too.


hazel
2020-9-2 17:19:10

@hazel has joined the channel


badkins
2020-9-2 19:00:38

I just do the following which is probably as quick as anything else:


badkins
2020-9-2 19:00:51

<ctrl>-c raco make app.rkt rlwrap racket app.rkt 1


badkins
2020-9-2 19:01:48

Everything is in command history for that shell tab, so it’s fast, but not fancy :)


badkins
2020-9-2 19:03:52

I do admit I was spoiled by Rails code reloading though. I just saved the file and refreshed the browser. If the racket-reloadable does that, I’ll need to check it out.


hazel
2020-9-2 22:55:04

how do I represent an X-Expression in Typed Racket? (require/typed xml [#:opaque Xexpr xexpr?]) doesn’t appear to work


hazel
2020-9-2 22:56:33

(: test (String -> Xexpr)) (define (test str) `(p ,str))


hazel
2020-9-2 22:56:40

this type errors with that opaque type


sorawee
2020-9-2 23:04:55

If you really want to use that opaque type, then you need a cast, I think.


sorawee
2020-9-2 23:05:07

(define (test str) (cast `(p ,str) Xexpr))


hazel
2020-9-2 23:05:18

is there a better way of representing an xexpr as a type?


sorawee
2020-9-2 23:06:30

I think it’s possible. I know there’s SExp type, which is very similar to XExpr.


hazel
2020-9-2 23:06:53

frankly, SExp is probably fine


hazel
2020-9-2 23:07:52

(define-type Xexpr Sexp) ; close enough


sorawee
2020-9-2 23:09:00

See also JSExpr


sorawee
2020-9-2 23:09:30

(define-type JSExpr (U 'null Boolean String Integer Inexact-Real (Listof JSExpr) (HashTable Symbol JSExpr)))


hazel
2020-9-2 23:11:25

looking that up made me realize that making an opaque Url type was useless, so thanks


hazel
2020-9-2 23:11:34

(didn’t realize typed/net/url was a thing)


samth
2020-9-3 01:28:39

xexprs are easy to write down with Typed Racket


samth
2020-9-3 01:29:59

(define-type Xexpr (U String (List* Symbol (Listof (List Symbol String)) (Listof Xexpr))) is pretty close


sorawee
2020-9-3 01:40:15

I’m surprised that it doesn’t need Rec. When must Rec be used then?


samth
2020-9-3 01:41:19

there’s an implicit top-level recursion


sorawee
2020-9-3 04:02:05

Right. Is it accurate then that Rec is unnecessary for users because they can always use the implicit top-level recursion instead?


josef.richter
2020-9-3 05:44:55

@josef.richter has joined the channel