小编JJJ*_*JJJ的帖子

懒惰和异常如何在Haskell中协同工作?

问题类似于这个问题.但是,这个是关于异常,而不是懒惰的I/O.

这是一个测试:

{-# LANGUAGE ScopedTypeVariables #-}

import Prelude hiding ( catch )
import Control.Exception

fooLazy :: Int -> IO Int
fooLazy m = return $ 1 `div` m

fooStrict :: Int -> IO Int
fooStrict m = return $! 1 `div` m

test :: (Int -> IO Int) -> IO ()
test f = print =<< f 0 `catch` \(_ :: SomeException) -> return 42

testLazy :: Int -> IO Int
testLazy m = (return $ 1 `div` …
Run Code Online (Sandbox Code Playgroud)

haskell exception lazy-evaluation ghc

9
推荐指数
1
解决办法
734
查看次数

获取ASDF系统的版本

您可以在ASDF系统中设置的其他内容是:version属性.有没有办法在运行时读取它?有点像(system-version :my-system-name)

我知道有asdf:version-satisfiesasdf:asdf-version,但也做我想做的在这种情况下.

common-lisp asdf

0
推荐指数
1
解决办法
398
查看次数

标签 统计

asdf ×1

common-lisp ×1

exception ×1

ghc ×1

haskell ×1

lazy-evaluation ×1