Thank you Richard, Lennart, *Gergő* >* pattern Positive :: (Ord a, Num a) => a*
>* pattern Positive <- ((>0) -> True)* *Heh heh, there's another surprise/undocumented 'feature'.* *It's not necessary to give a signature for pattern `Positive`, GHC will infer that from the decl.* *I was surprised to see `True`, and even more surprised there wasn't a `Bool` in the signature. I guess that's so `Positive` can appear as a pattern in a case expr. To dig out the positive value in a lambda expr, it seems I go* *> (\p@Positive -> p) 5 -- returns 5* *Seems I can't use any trick like that to turn `Positive` into explicitly bidirectional. I also tried* >* pattern Positive' <- ((>0) -> ())* *But that's rejected '"** Couldn't match expected type `Bool' with actual type `()'". Is the hidden `Bool` documented somewhere? (Doesn't seem to be in the User Guide nor the wiki nor the paper, on a quick scan.)
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users