Skip to content

Commit

Permalink
first approach for adressing llvm fails
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubSchwenkbeck committed Jan 14, 2025
1 parent 30da4eb commit d527f67
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/stdlib/exception/combinators.effekt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module examples/pos/exception/combinators

import exception

/**
* Used as a type for `Exception` purely for independent testing
*/
Expand All @@ -11,11 +12,11 @@ def testException(): Nothing / Exception[TestException] =



def main() = {
def main() : Unit = {
// Test for default handling of Test Exception
def defaultTestException { p: => String / Exception[TestException] }: Unit = {
with on[TestException].default { println("Exception handled by default combinator") }
println(p().show)
println(p().show)
}

defaultTestException { testException() } // Exception
Expand Down Expand Up @@ -44,7 +45,7 @@ def main() = {
try {
with on[TestException].finalize { println("Finalizer executed") }
println(p().show) // Run the operation that might throw an exception
} with Exception[TestException] { def raise(exception, msg) = () } // Ignore the exception
} with exc : Exception[TestException] { def exc::raise(exception, msg) = () } // Ignore the exception
}

finalizeTestException { testException() } // Finalizer executed with exception
Expand Down

0 comments on commit d527f67

Please sign in to comment.