I do a lot of exploratory coding in GHCi, and as such, I'm tinkering with a script to persist definitions across GHCi sessions and reloads like so:*> :sr narp = putStrLn "Narp!" *> :do m <- return "Ok" *> narp Narp! *> m "Ok" *> :q ...>ghci *> :ls *> narp Narp! *> m "Ok"
... and I've run into a snag. If I use :sr to define a function which does not type check, I still persist it. Now, I do have a :dl command to delete the last definition persisted with :sr, but that is subject to human error. Is there any fairly simple trick I'm overlooking that would let me catch this automatically?
Alternatively, is there something that already does this so I don't have to?submitted by WarDaft
[link] [4 comments]