If I want a version of reads
that returns a list of (Int, String)
, the example I see is
f x = reads x :: [(Int,String)]
I'd like to know if there's a way to do this in point-free style (f = g . reads
?), or if this is something you just don't/can't do in Haskell.
I haven't seen any examples of using a type as an argument, so it may not be doable.
I think what you're looking for is f = reads :: String -> [(Int, String)]
.
The idiomatic way to do what you're describing is
f :: String -> [(Int, String)]
f = reads
The benefit to doing it this way is if you have a polymorphic type the result is what you'd expect (because of the Dreaded Monomorphism Restriction).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With