Contracts from definitions window implied to the interactions window?

When opening DrRacket with a file that provides contracted procedures, the contracts are not checked when calling a procedure in the interactions window. A simple solution is:

(define my-module base-module
source ...)

(require 'my-module)
(provide (all-from-out 'my-module))

Would it be possible and desirable to make the interaction window check contracts without this hack?

An easier hack is to leave your source code as usual, but use:

(require (submod "."))

in the interactions window to get the contracted versions of exports.


#lang racket

(provide/contract (f (-> integer? integer?)))

(define (f x) x)

RUN


Welcome to DrRacket, version 8.14.0.4 [cs].
Language: racket, with test coverage [custom].
> (require (submod "."))
> (f 'a)
. . f: contract violation
expected: integer?
given: 'a
in: the 1st argument of
(-> integer? integer?)
contract from: anonymous-module
blaming: anonymous-module
(assuming the contract is correct)
at: 63-unsaved-editor:3:19

Thanks to both Matthias F and LiberalArtist. Works well too, but does require me to remember to require the submod in the interactions window. With my hack I can change the definitions window and immediately try it in the interactions window, without re-requiring (submod ".").