Tuesday, September 1, 2020

February 2019 Haskell 1-liners

 

  • February 18th, 2019:
    Define ext :: (Maybe a, b) -> Maybe (a,b)
    e.g.: ext (Just 5, "Hi") = Just (5, "Hi")
    • Al͜l ̸͑ha͂͟il̶! @TechnoEmpress \o/ 
    • cλementd @clementd `fmap swap. sequenceA . swap` :-)
    • Raveline @Raveline bisequence . second pure
    • Alexey Radkov @sheshanaag uncurry (flip $ fmap . flip (,))
    • a fool @fresheyeball ext = \case (Just x, y) -> Just (x, y); _ -> Nothing