In Mathematica, a function is ShowItusually used for debugging. In principle, ShowItit is an identification function that displays the value of its parameter to the console. I wonder how you can write the same function for Haskell. The problem with Haskell is that since the function performs IO, it cannot have the same return type as the input type. I think we should use unsafe IO for implementation ShowIt. But I have no idea how to do this.
ShowIt
It already exists in the package Debug.Trace. He is called traceShowId. (And it uses unsafePerformIOunder the covers - you can see the implementation tracehere .)
Debug.Trace
traceShowId
unsafePerformIO
trace