- May 27th, 2018:
data F = F { a, b, c :: String }
data Stamped a = { time :: Day, stamped :: a }
f :: Stamped F -> String
output of f x is "time a b c" for the respective values of time, a, b, c
Is there some monadic / applicative elegant definition that does this? - Nickolay Kudasov @crazy_fizruk
f = intercalate “ “ . sequence [ show.time, a.stamped, b.stamped, c.stamped ] - Nickolay Kudasov @crazy_fizruk
f = intercalate " " <$> http://pure.show .time <> (sequence [a, b, c]).stamped
A bit trickier, but shorter and uses stamped once. - April 13th, 2018: given f :: [a] -> b -> [c]
where c is a derived from g :: a -> b -> c
You have [a] and [b]
Write a function h :: [a] -> [b] -> [c] from f
Incorporates strong typing over predicate logic programming, and, conversely, incorporates predicate logic programming into strongly typed functional languages. The style of predicate logic is from Prolog; the strongly typed functional language is Haskell.
Monday, February 18, 2019
April/May 2019 1HaskellADay 1Liners
January 2019 1HaskellADay Problems and Solutions
- January 30th, 2019: Wednesday's #haskell problem is to take the JSON-y articles and the HTML-encoded articles and sort them by id and by date.
- January 29th, 2019: For Tuesday's #haskell problem we convert JSON-like strings to valid HTML strings, handling irregularities (gracefully!) in the input data as we go. For Tuesday's #haskell solution we convert text to text when you're not sure of the structure a priori.
- January 28th, 2019: Hello, Haskellers! Happy New Year! Monday's #haskell problem is a little warming-up JSON parsing exercise to get back into the swing of things. Monday's #haskell solution uses the Data.Aeson library to parse the JSON into Haskell data structures.
Subscribe to:
Posts (Atom)