Does Rackt’s match
have something like what Haskeller’s call “as patterns”, which allow you to bind a complex subpattern to an identifier?
You can use and
pattern, like (and lst (list x y z))
That’s great, thanks!
I’m a little stuck on a basic question about logging, and specifically about making a new logger. In the Reference, section 15.5.1, there seem to be two ways to create a new logger: make-logger
(which returns a logger) and define-logger
(which defines a set of forms like log-foo-warning
and so on). The second looks like a convenience form, which is nice; but only the first allows one to specify the level of messages which should be propagated to the logger’s parent. That is, I presume that, if I use define-logger
then all messages are propagated.
Is that right? Is the intended approach that one create a logger with make-logger
, specifying a propagation level, then immediately create a child logger of that with define-logger
?
In practice I normally just make toplevel loggers with define-logger
, but my usage of the logging system so far has been fairly unsophisticated.
Thanks, @samdphillips: I will assume I’m not missing something obvious and forgo the convenience if I need to filter.
@mihaidobri has joined the channel
Writing a backend web application without send/suspend
is a major difficulty, but I guess that qualifies as continuation-used-by-a-library-implementer. In any case, if you didn’t know this use-case, there it is. It’s a pretty obvious case of the power. This “primitive” is <https://docs.racket-lang.org/continue/|presented in a tutorial>.
@jgeddes Those propogate-level
and propogate-topic
arguments to make-logger
were added later. You can definitely use them if you need/want to.
But I think the more common approach is to use define-logger
. With that, the log receiver(s) determine the levels and topics of logger messages — it’s driven by who’s interested in getting how much detail about what.
So, again, if you need/want you can do this filtering “up front” in the loggers. But that means receivers can’t control it.
Hello, I try to define a Bar
type like this: (define-type Bar (All (A) (A Number)))
(define-type Foo (Bar (All (I) (U I Symbol))))
I know that type variables declared by All
are not polymorphic types. Is it possible to define Bar
in another way?
No, unfortunately it’s not possible to make this work. This is a fundamental limitation because polymorphic types and type constructors are unified in Typed Racket (which was a bad idea).
I see. Thanks!
Proposals to entirely re-do how type constructors work in TR are welcome, though. :slightly_smiling_face:
@343519265 has joined the channel