CDE
This commit is contained in:
parent
518da4a923
commit
764da6cbbb
6144 changed files with 83610 additions and 11 deletions
2
Task/Exceptions/Haskell/exceptions-1.hs
Normal file
2
Task/Exceptions/Haskell/exceptions-1.hs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
do {- ... -}
|
||||
throwIO SomeException
|
||||
2
Task/Exceptions/Haskell/exceptions-2.hs
Normal file
2
Task/Exceptions/Haskell/exceptions-2.hs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
if condition then 3
|
||||
else throw SomeException
|
||||
2
Task/Exceptions/Haskell/exceptions-3.hs
Normal file
2
Task/Exceptions/Haskell/exceptions-3.hs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
if condition then 3
|
||||
else throwDyn myException
|
||||
4
Task/Exceptions/Haskell/exceptions-4.hs
Normal file
4
Task/Exceptions/Haskell/exceptions-4.hs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
do
|
||||
{- do IO computations here -}
|
||||
`catch` \ex -> do
|
||||
{- handle exception "ex" here -}
|
||||
4
Task/Exceptions/Haskell/exceptions-5.hs
Normal file
4
Task/Exceptions/Haskell/exceptions-5.hs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
do
|
||||
{- do IO computations here -}
|
||||
`catchDyn` \ex -> do
|
||||
{- handle exception "ex" here -}
|
||||
17
Task/Exceptions/Haskell/exceptions-6.hs
Normal file
17
Task/Exceptions/Haskell/exceptions-6.hs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import Exceptions
|
||||
|
||||
procedure main(A)
|
||||
every i := !A do {
|
||||
case Try().call{ write(g(i)) } of {
|
||||
Try().catch(): {
|
||||
x := Try().getException()
|
||||
write(x.getMessage(), ":\n", x.getLocation())
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
procedure g(i)
|
||||
if numeric(i) = 3 then Exception().throw("bad value of "||i)
|
||||
return i
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue