turn off lazy evaluation in haskell

前端 未结 7 2045
长发绾君心
长发绾君心 2020-12-14 19:03

Is it possible to turn off lazy evaluation in Haskell?

Is there a specific compiler flag of library to facilitate this?

I wanted to try something new with

7条回答
  •  情书的邮戳
    2020-12-14 19:16

    There are a number of ways to turn a lazy thing strict. You can:

    1. Explicitly insert a spurious pattern match.
    2. Use seq or its close relative ($!).
    3. Use BangPatterns.
    4. Use strictness annotations on your types.

    More information here.

提交回复
热议问题