Search code examples
schemechicken-scheme

How do I use a SRFI inside a module in Chicken Scheme?


The following file gives an error when it is compiled with csc.

(module
 monoid *
 (import chicken scheme)
 (use srfi-9)
 (define-record-type a0 (a0) a0?))

The error is:

Syntax error (import): cannot import from undefined module
    srfi-9
    Expansion history:
    ...

I followed an example in "The CHICKEN User's Manual/Supported language/Modules/Examples of using modules".


Solution

  • Some smaller SRFIs are part of the chicken module. You can just remove the (use srfi-9) line.

    I know that this is somewhat confusing, but if you read it carefully, the manual doesn't state that there is a module for it (and indeed, there isn't). This too has been made a bit saner in the upcoming CHICKEN 5. There, srfi-9 is a clean, separate module, and your example program works as-is on CHICKEN 5.