The order of semantic approximation states that if a function is fdefined when its arguments are absent, then it fis a constant in this argument (it does not use it). But consider this function,
f
import Control.Exception handleAll :: SomeException -> IO () handleAll e = putStrLn "caught" f :: String -> IO () f x = catch (putStrLn x) handleAll
f undefineddisplays caughtin GHCi, so it looks specific. However, fit is not a constant in its argument, because it f "test"displays test.
f undefined
caught
f "test"
test
Is there a mistake somewhere?
catch , ( ). . (pdf) , GHC.
catch
, " " Haskell, IO a ( ).
IO a
, " " Haskell, IO
IO
data IO a = MkIO
catch a h = MkIO
f, f undefined f "test" MkIO.
MkIO
[[IO t]] = {⊥ < ⊤}
IO t
, IO, seq IO, , , length :: [Bool] -> Integer, , , -. , , .
seq
length :: [Bool] -> Integer
Source: https://habr.com/ru/post/1671451/More articles:Need to access a service in a function - angularUsing constexpr if instead of macros when writing platform-specific code? - c ++Running xunit.console.runner on OSX - xunitRelease multiple assemblies in a single .net network packet - c #Core Data Crash - NSPersistentStoreCoordinator does not have persistent storage (corrupted file) - iosWhen I change the position of the axis, ggplot stops the rotation of the axis label - rfinishComposingText in inactive InputConnection - androidhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1671454/any-way-to-implement-ads-to-kivy-app&usg=ALkJrhiGOCQr2inhfH4pbt1h-xn1UKHKbgUsing JavaFX Application.stop () method for Shutdownhook - javaКак HashMap реализует интерфейс MutableMap в Котлине? - javaAll Articles