{-# LANGUAGE Haskell2010, Unsafe #-}
{-# OPTIONS -Wall #-}

-- |
-- Module       : Haskell.X.Unsafe
-- Copyright    : (c) Julian Fleischer 2013
-- License      : MIT (See LICENSE file in cabal package)
--
-- Maintainer   : julian.fleischer@fu-berlin.de
-- Stability    : provisional
--
-- Unsafe functions (use for debugging only).
module Haskell.X.Unsafe where

import qualified Debug.Trace as Debug
import System.IO.Unsafe

-- | @trace x@ shows and returns @x@.
trace :: Show a => a -> a
trace a = Debug.trace (show a) a

-- | @debug x a@ shows @x@ and returns @a@.
debug :: Show b => b -> a -> a
debug b a = Debug.trace (show b) a

-- | This is a shorthand for 'unsafePerformIO'.
io :: IO a -> a
io = unsafePerformIO