<div dir="ltr"><div><div>Hi Ivan,<br></div>I could use isNothing, but the data is forall'ed...<br></div>I tried but it doesn't work:<br><div><br><span style="font-family:monospace,monospace">data SomeData = forall e. (Typeable e, Eq e) => SomeData e<br><br>isNothing' :: SomeData -> Bool<br>isNothing' (SomeData a) = case (cast a) of<br> (a :: Maybe a) -> isNothing a</span><br><br>Could not deduce (Typeable a) arising from a use of ‘cast’<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 20, 2016 at 11:21 PM, Ivan Lazar Miljenovic <span dir="ltr"><<a href="mailto:ivan.miljenovic@gmail.com" target="_blank">ivan.miljenovic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 21 July 2016 at 02:30, Corentin Dupont <<a href="mailto:corentin.dupont@gmail.com">corentin.dupont@gmail.com</a>> wrote:<br>
> I see....<br>
> The think is, I am interested to know if "e" is "Nothing", whatever the type<br>
> of Nothing is!<br>
<br>
</span>Data.Maybe.isNothing ?<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
><br>
><br>
> On Wed, Jul 20, 2016 at 5:44 PM, Patrick Chilton <<a href="mailto:chpatrick@gmail.com">chpatrick@gmail.com</a>><br>
> wrote:<br>
>><br>
>> It's because you're doing === Nothing and the type of the Nothing is<br>
>> ambiguous (Maybe a1).<br>
>><br>
>> On Wed, Jul 20, 2016 at 5:18 PM, Corentin Dupont<br>
>> <<a href="mailto:corentin.dupont@gmail.com">corentin.dupont@gmail.com</a>> wrote:<br>
>>><br>
>>> Hi all,<br>
>>> I'm surprised this doesn't work:<br>
>>><br>
>>> data SomeData = forall e. (Typeable e, Eq e) => SomeData e<br>
>>><br>
>>> (===) :: (Typeable a, Typeable b, Eq a, Eq b) => a -> b -> Bool<br>
>>> (===) x y = cast x == Just y<br>
>>><br>
>>> test :: SomeData' -> Bool<br>
>>> test (SomeData' e) | e === Nothing = True<br>
>>> test _ = False<br>
>>><br>
>>> It says<br>
>>> Could not deduce (Eq a1) arising from a use of ‘===’<br>
>>><br>
>>> How can I achieve something of the same effect?<br>
>>><br>
>>> Thanks<br>
>>> Corentin<br>
>>><br>
>>> _______________________________________________<br>
>>> Haskell-Cafe mailing list<br>
>>> To (un)subscribe, modify options or view archives go to:<br>
>>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
>>> Only members subscribed via the mailman list are allowed to post.<br>
>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> To (un)subscribe, modify options or view archives go to:<br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
> Only members subscribed via the mailman list are allowed to post.<br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Ivan Lazar Miljenovic<br>
<a href="mailto:Ivan.Miljenovic@gmail.com">Ivan.Miljenovic@gmail.com</a><br>
<a href="http://IvanMiljenovic.wordpress.com" rel="noreferrer" target="_blank">http://IvanMiljenovic.wordpress.com</a><br>
</font></span></blockquote></div><br></div>