[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-beginners
Subject: Re: [Haskell-beginners] Showing Types
From: Alex Rozenshteyn <rpglover64 () gmail ! com>
Date: 2016-03-08 15:26:21
Message-ID: CALm==BWHyVZCZKj2QXOATmvSTxPWT1z9JsZAKiVuD=_WaAty1w () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
And you also run into trouble with typeOf Nothing.
On Tue, Mar 8, 2016 at 10:09 AM, Alex Rozenshteyn <rpglover64@gmail.com>
wrote:
> > But it works on concrete types, not functions.
>
> Isn't the problem type variables, not functions?
>
> Prelude Data.Typeable> :set -XScopedTypeVariables
> Prelude Data.Typeable> let fun x = case x of {Just (i::Int) -> i + 1;
> Nothing -> 0}
> Prelude Data.Typeable> :t fun
> fun :: Maybe Int -> Int
> Prelude Data.Typeable> typeOf fun
> Maybe Int -> Int
>
>
[Attachment #5 (text/html)]
<div dir="ltr">And you also run into trouble with <span \
style="font-family:monospace,monospace">typeOf Nothing</span><font \
face="arial,helvetica,sans-serif">.</font><br></div><div class="gmail_extra"><br><div \
class="gmail_quote">On Tue, Mar 8, 2016 at 10:09 AM, Alex Rozenshteyn <span \
dir="ltr"><<a href="mailto:rpglover64@gmail.com" \
target="_blank">rpglover64@gmail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><span class=""><div>> But it works on \
concrete types, not functions.<br><br></div></span>Isn't the problem type \
variables, not functions?<br><span \
style="font-family:monospace,monospace"><br>Prelude Data.Typeable> :set \
-XScopedTypeVariables<br>Prelude Data.Typeable> let fun x = case x of {Just \
(i::Int) -> i + 1; Nothing -> 0}<br>Prelude Data.Typeable> :t fun<br>fun :: \
Maybe Int -> Int<br>Prelude Data.Typeable> typeOf fun<br>Maybe Int -> \
Int</span><br><br></div> </blockquote></div><br></div>
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic