Function ?_ - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.


I guess I'll just leave this here :sweat_smile: :

infix 0 ?
(?) :: ((?_ :: a) => b) -> a -> b
x ? a = let ?_ = a in x
ghci> (?_, ?_, ?_) ? "y"

Basically, ImplicitParams seem to support _ as parameter name, so we can write function that uses it in a way that looks nearly like Scala's anonymous functions :big_smile:


One could write nice predicates with this:

filter (?_ > 5 && isLower (chr ?_) ?) xs

Or provide concise interface for some SQL library in combination with OverloadedRecordDot:

select (?, ? $ from @Users & where_ (? .==. val "[email protected]")

Or maybe we could just forget about it and never use it again :sweat_smile:

Torsten Schmits

Has Type Inference Gone Too Far?

Sridhar Ratnakumar

Oh damn, this topic broke zulip-archive,

GitHub is where people build software. More than 56 million people use GitHub to discover, fork, and contribute to over 100 million projects.
Sridhar Ratnakumar
* Raised the exception:
Cannot build slug for "?_"

Hard to create a reproducible URL slug here ...

Sridhar Ratnakumar

/me renamed the topic to see if that helps, for now.

Sridhar Ratnakumar

I guess one solution is to just fallback to hash of the topic name.