Skip to content

Instantly share code, notes, and snippets.

@fghibellini
Created November 11, 2019 20:48
Show Gist options
  • Save fghibellini/680c45e4a6660e00a0a697fb742502da to your computer and use it in GitHub Desktop.
Save fghibellini/680c45e4a6660e00a0a697fb742502da to your computer and use it in GitHub Desktop.
HasCallStack with argument
{-# LANGUAGE RankNTypes #-}
import Control.Monad (forM_)
import GHC.Stack
httpCall :: HasCallStack => String -> IO ()
httpCall url = do
putStrLn $ prettyCallStack callStack
print $ "GET " <> url <> " resolved"
retry :: HasCallStack => (HasCallStack => a -> IO()) -> a -> IO ()
retry op arg =
forM_ [1] $ \i ->
op arg
main :: IO ()
main = retry httpCall "/users"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment