Cafe,<br><br>Is there a way (without going into the IO lands) to achieve this:<br><br style="font-family: courier new,monospace;"><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">data T = A | B | C</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">func1 :: T -&gt; T</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">func1 A = B</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">func1Fixed :: T -&gt; Maybe T</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">func1Fixed A = Just B</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">func1Fixed _ = Nothing</span><br></div><br>I want a function to generate func1Fixed, given func1. <br><br>I guess this is doable with exception handling (catching the error from func1)? Is it the only way?<br>
<br>Best,<br><br>-- <br>Ozgur Akgun