-----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 Brandon S Allbery KF8NH <allber...@gmail.com> wrote:
> Haskell is actually what manufacturing folks call "just in time"; > things are evaluated when they are needed. Usually this means that > when you output something, anything needed to compute that output will > be done then. The exceptions are things like > Control.Exception.evaluate (which you can treat as doing output but > without *actually* outputting anything), mentioned above, plus you can > indicate that some computation must be evaluated before another by > means of Prelude.seq. You can also declare a type as being strict by > prefixing an exclamation mark (so the runtime will always evaluate a > computation before binding it), and with the BangPatterns extension > you can also declare a pattern match binding as strict the same way. Note that pattern matches are strict by default. In fact, a pattern match is the preferred way to force evaluation. Bang patterns only make sure that variables (i.e. wildcards, which wouldn't be evaluated otherwise) in a pattern match are evaluated to WHNF: case expr of Just x -> ... Nothing -> This is strict in the Maybe constructors, but non-strict in the argument of Just. When using a bang pattern, Just (!x) -> ... the match is also strict in the argument of Just. A bang pattern is really just a shortcut for using 'seq': Just x -> seq x $ ... or as some people prefer to write it: Just x | seq x True -> ... Greets, Ertugrul - -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBAwAGBQJNW6RSAAoJENVqN/rl3Y0RpmcQAI8no1y9NopXHKx0zCV+xV4W R2i2JdkPl8s7z+BpQLFqdKk+y9CfhqDLTwE+v8ek7fhnJXFWHqvGpi/1p6u3DRuO /ho8YNrzp8gKj0EF0Dn0VCwZ7qdmDBtmNXdHlMUzz2pTd968/9tK0FyUSb20qiBT Suv8lPv8shsGfYX29apo1JCcHRplfeS9wJpIk0/J5xaddTDElL0CBMWkehRFFlHi MVB3KS/6VnCqTCd8RtykzzmxtN2d+sf4a96h9RQWFt/62UPGfH04l2kY+1YiP6fK OaV0iqHyM1TLKT/tzp+duZ57TJ2MX5h00WczHduE01Y+7nnB8b67TAvUXJI21IwA loh1rHlqSoPI/lF1Ti5iJEF2K74waONtl7AM+lmOQZDVuipALQvesXSWTEvS18Mm fo052MUwzWgAXU4hwod5ZvjUNR92Z9vL5JAb1MP7DShE+sLJiXYDAD381XKU6FSi 0C4rMo553JXJcMNrnJhzdxDrfJCzcHIdePG6XOkH+EzRIUPs+mYlHuNTrFbZtyzC LzqfIwDMRQLo0f3KT5cj+6eDV/sUELW3seaTFUSCfIQhJ3molsimQHQy7YsJvvp7 fkcxpAfnAegiTQydfvUFFsdW+ZELeZTyW06iedMisUx1Lhww4Butee8PTZex3jHV qH/RghfnSK3w/cwiZez2 =ecix -----END PGP SIGNATURE----- _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe