Function ?_ - Haskell

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

TheMatten

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

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

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:

TheMatten

One could write nice predicates with this:

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

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

select (?_.id, ?_.name) $ from @Users & where_ (?_.email .==. val "example@example.com")
TheMatten

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, https://github.com/srid/zulip-archive/runs/2406184027?check_suite_focus=true

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.