Skip to content

Instantly share code, notes, and snippets.

@jhrcek
Last active March 3, 2021 15:42
Show Gist options
  • Save jhrcek/add57d5e29cd2a65bc98cfc534882741 to your computer and use it in GitHub Desktop.
Save jhrcek/add57d5e29cd2a65bc98cfc534882741 to your computer and use it in GitHub Desktop.
How to case split in monadic do block
data Thing = A | B | C
getThing :: IO Thing
getThing = pure A
f :: Int -> IO ()
f i = do
thing <- getThing
-- TODO what can I do here to make the tactics plugin offer "case split" code action?
case thing of
-- This only gives code action to "Add EmptyCase" language extension..
@isovector
Copy link

try this:

f :: Int -> IO ()
f i = do
    thing <- getThing
    _

and then run the "Case split on thing" code action when hovering over the hole

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment