This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Result size = 325 | |
Main.$fFunctorTreeT_$cfmap | |
:: forall a_ajJ b_ajK. | |
(a_ajJ -> b_ajK) -> Main.TreeT a_ajJ -> Main.TreeT b_ajK | |
[GblId, | |
Arity=2, | |
Caf=NoCafRefs, | |
Str=DmdType LS, | |
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=2, Value=True, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CoerceUsingUnsafe where | |
import Data.IORef | |
import System.IO.Unsafe (unsafePerformIO) | |
import Data.Word | |
{- The trick behind this function is in the `test` experession. | |
When we create a new mutable variable in the IO monad, | |
it has a side effect of creating it somewhere in the memory. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/q/10236953/1333025 | |
I quite enjoyed this exercise. I tried to do it without looking at the answers, | |
and it was worth it. It took me considerable time, but the result is | |
surprisingly close to two of the other answers, as well as to | |
[monad-coroutine](http://hackage.haskell.org/package/monad-coroutine) library. | |
So I guess this is somewhat natural solution to this problem. Without this | |
exercise, I wouldn't understand how _monad-coroutine_ really works. | |
To add some additional value, I'll explain the steps that eventually led me to |
NewerOlder