关闭haskell中的懒惰评估 [英] turn off lazy evaluation in haskell

查看:103
本文介绍了关闭haskell中的懒惰评估的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能关闭Haskell中的懒惰评估?

有没有一个特定的库编译器标志来方便这个?



我想用我之前写过的旧程序尝试一些新功能,以了解是否可以提高性能。

解决方案

有很多方法可以将懒惰的事情变得严格。您可以:


  1. 显式插入伪造模式匹配。 使用 seq 或其近亲($!)

  2. 使用 BangPatterns

  3. 在您的类型中使用严格注解。 此处


    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 a old program that I had written a while back, to see if I can improve performance.

    解决方案

    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.

    这篇关于关闭haskell中的懒惰评估的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆