[Haskell-cafe] Re: ANNOUNCE: HNOP 0.1
Ashley Yakeley
ashley at semantic.org
Fri Jun 30 17:52:54 EDT 2006
Simon Marlow wrote:
> My congratulations to the development team; this is an important
> contribution to the community.
Thanks!
> You might want to use {-# OPTIONS_GHC #-} rather than {-# OPTIONS #-},
> unless compatibility with older versions of GHC is a goal. Still, the
> pragma only turns on warnings, so it's harmless.
Applied, thanks. At some point I want to do equivalent things for other
compilers. I generally like to be pretty strict about warnings,
especially as one can selectively disable them if needed.
> noop :: IO () -- generalise to other Monads?
>
>
> Only IO makes sense really, since by definition every non-IO expression
> does nothing, so the only interesting way to do nothing is in the IO
> monad.
Agreed. The concept of "doing nothing" is best understood within the
conceptual domain of "doing things" in the IO sense. I shall also be
resisting any calls for an unsafe version (unsafeNoOp :: ()).
I'm currently considering possible unit tests, since right now I rely
solely on code inspection. One possibility would be to simply time the
function to show that it didn't have time to do anything really long at
least. But that's not very satisfactory, since that is strictly a
performance test, not a functionality test. It's like any other Haskell
function: I want to implement it as efficiently as possible, but I don't
guarantee any particular performance.
Ideally I would have tests like these:
* Verify noop does nothing with the file system.
* Verify noop does no networking activity.
* Verify noop makes no use of stdin/stdout/stderr.
* Verify noop does not modify any external IORefs.
etc.
Actually, I think the fourth one may be unnecessary, given that we don't
have global mutable state. The third might not be too hard. It's not
clear how to do the others, however. I should hate to discover that a
bug in my implementation was accidentally causing it to behave as a
secure distributed HTTP-addressable digital media semantic content
management system.
--
Ashley Yakeley
Seattle WA
More information about the Haskell-Cafe
mailing list