<p dir="ltr">Thanks for the help!</p>
<div class="gmail_quote">On Jan 22, 2015 5:03 PM, "wren romano" <<a href="mailto:winterkoninkje@gmail.com">winterkoninkje@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Jan 20, 2015 at 12:09 AM, Cody Goodman<br>
<<a href="mailto:codygman.consulting@gmail.com">codygman.consulting@gmail.com</a>> wrote:<br>
> I understand the error below, but I'm not really sure what an instance of<br>
> liftIO would look like for the Identity functor. I guess I'm not all to<br>
> clear on what an identity functor is.<br>
><br>
> I'm a little fuzzy on what an identity monad is. I understand that id gives<br>
> the identity of something back pretty well though. Can anyone help?<br>
<br>
The identity functor/monad is this:<br>
<br>
    newtype Identity a = Identity { runIdentity :: a }<br>
<br>
That is, the type constructor `Identity` works like the function `id`,<br>
but on the type level. It doesn't add any sort of special effects, it<br>
just gives us a type constructor that we can use whenever we need<br>
something of kind * -> *, like when working with monad transformer<br>
stacks.<br>
<br>
Identity is trivially a monad:<br>
<br>
    instance Functor Identity where<br>
        fmap f (Identity x) = Identity (f x)<br>
<br>
    instance Applicative Identity where<br>
        pure x = Identity x<br>
        Identity f <*> Identity x = Identity (f x)<br>
<br>
    instance Monad Identity where<br>
        return x = Identity x<br>
        Identity x >>= f = f x<br>
<br>
If we erase all the newtype un/wrapping, then we can see that all<br>
these functions are just variations on ($) and `id`. That's why we say<br>
it's trivial.<br>
<br>
--<br>
Live well,<br>
~wren<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div>