A JSExpr is one of a couple of things:

- A list
- A hash with symbol keys
- A number
- A string
- A boolean
- Null

The (andmap string?) approach implicitly assumes you're giving it a list. 
But it might be something else instead, so you want this: (and (list? js) 
(andmap string? js))

On Monday, February 25, 2019 at 3:44:38 PM UTC-8, Brian Craft wrote:
>
> So, that also gives me a type error:
>
>  Type Checker: Polymorphic function `andmap' could not be applied to 
> arguments:
> Domains: (-> a b ... b c) (Listof a) (Listof b) ... b
>          (-> a c : d) (Listof a)
> Arguments: (-> Any Boolean : String) (U EOF JSExpr)
>
>   in: (andmap string? s)
>
>
> On Monday, February 25, 2019 at 3:22:12 PM UTC-8, Sam Tobin-Hochstadt 
> wrote:
>>
>> I think (andmap string? ...) is probably the easiest way to check that. 
>>
>> Sam
>>
>> On Mon, Feb 25, 2019, 6:20 PM Brian Craft <[email protected]> wrote:
>>
>>> In typed racket, parsing a string list gives me a JSExpr, which is a 
>>> union. I need to pass it to functions that operate on string lists, but 
>>> can't figure out how to please the type checker. Maybe with occurrence 
>>> typing? But I don't know how to assert "this is a list of strings".
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Racket Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to