Returning unit #50
Replies: 1 comment
-
Agree, it’s just an oversight. On paper it should just be a case of adding () to the list of supported types and then desugaring it appropriately.
…On Sun, Oct 27, 2024, at 7:11 PM, Michael Xavier wrote:
I'm probably missing something obvious but I don't seem to be able to return `()` from a function. Sometimes I'll have a conditional that prints a message in one case and runs an effect that returns a value that I don't need in the other. There's no `Monad.void` and `Monad.return ()` gives me `Invalid variable: ()`. My workaround is to do `Text.putStr ""` which is kind of weird.
—
Reply to this email directly, view it on GitHub <#50>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAACWC7LTTUJKI4VQMKUZV3Z5U3E7AVCNFSM6AAAAABQWCXDOKVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXGM3TQMJRG4>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
MichaelXavier
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm probably missing something obvious but I don't seem to be able to return
()
from a function. Sometimes I'll have a conditional that prints a message in one case and runs an effect that returns a value that I don't need in the other. There's noMonad.void
andMonad.return ()
gives meInvalid variable: ()
. My workaround is to doText.putStr ""
which is kind of weird.Beta Was this translation helpful? Give feedback.
All reactions