Tuesday, February 6, 2018
Wednesday, January 31, 2018
- January 30th, 2018: For Tuesday's #haskell problem we look at triaging articles downloaded from a REST endpoint against our PostgreSQL database. Who knew putting things into three bins could be so much fun? Today's #haskell solution triages work for us.
- January 29th, 2018: Monday's #haskell problem is to fetch when the last set of articles were stored; two approaches. Monday's #haskell solution: two approaches to extract 'last entry' from the database, wanted; two approaches to extract 'last entry' from the database, GOT!
- January 26th, 2018: Friday's #haskell problem is to pull a week's worth of data from a REST endpoint when we don't know a priori how many calls we have to make. Friday's #haskell solution fetches then reads/parses blocks of articles from a REST endpoint.
- January 24th, 2018: Wednesday's #haskell problem is solving three more #Prolog-y list problems from P99: pack / encode / decode. It's great when #haskell has grouping / 'un'grouping functions in the library already.
- January 23rd, 2018: Tuesday's #haskell problem: groups and grouper ... I like grouper blackened, please! Solving today's #haskell problem with Qubits?!? Nah, not really, but that would be cool if we did!
- January 22nd, 2018: Monday's #haskell problem is a problem from P99: problem P21, list insertion. Monday's #haskell solution is inserting an element into a list, PROLOG-STYLE!
- January 18th, 2018: The whole enchilada! Today's #haskell problem ties it all together to make an ETL. Today's #haskell solution defines etl: Looping over calls to the REST endpoint then database insertions.
- January 17th, 2018: For today's #haskell problem we use PostgreSQL data store and Haskell to pick up where we left off on an application run. Today's #haskell solution: the audit log has what our program last did, so now we know what we'll work on next!
- January 16th, 2018: Where did yesterday's Haskell problem go? Here it is! Today's #haskell problem: read a packet from a REST endpoint. Today's #haskell solution accesses a REST endpoint with a set timeout and with the default timeout.
- January 15th, 2018: "Logging? Why do we have to log stuff?" Enterprise applications require audit trails. Today's #haskell problem provides one. What did your Haskell app do and when? Today's #haskell solution: an audit log.
- January 11th, 2018: Thursday's #haskell problem: pulling SQL lookup tables into Haskell. Thursday's #haskell solution: with the help of IxValues we extract lookup table values from SQL into Haskell Maps.
- January 10th, 2018: Wednesday's #haskell exercise is to store the packet information into the PostgreSQL database as a part of auditing the ETL process. Wednesday's #haskell solution stores the packets that wrap article sets then logs our results.
- January 9th, 2018: Tuesday's #haskell problem we are logging log messages to the log data table. YES! Tuesday's #haskell solution: logging in the style of log4j.
- January 8th, 2018: Monday's #haskell problem: once more into the breach, and thoughts on generalization – storing unique newspaper article sections in PostgreSQL. We store article section information, then we build a function that stores ANYTHING! ... and washes windows, TOO! *
- January 5th, 2018: Friday's #haskell problem takes a break from SQL Databases and Haskell and does something completely different: data schemes and Haskell. AHA! Friday's #haskell solution is a graph-view of the sections for a sample of 100 articles.
- January 4th, 2018: Thursday's #haskell problem looks at storing in PostgreSQL authors of periodic articles uniquely identified by uuid. Thursday #haskell solution uses etl function with generators to store parsed authors in PostgreSQL database.
- January 3rd, 2018: Wednesday's #haskell problem is in honor of Baron Munchausen and his fantastic adventures!
- January 2nd, 2018: WELCOME TO THE NEW YEAR, HASKELLERS!
Tuesday's #haskell problem leverages keywords-as-subjects and makes storing article keywords into PostgreSQL easier... we hope. Tuesday's #haskell solution Incorporates prior work with memoizing tables and subjects with results.
Friday, January 5, 2018
- December 29th, 2017:
given f :: Monad m => n -> a -> m (Maybe b)
define g :: Monad m => n -> a -> m (a, Maybe b)
using f and ... arrows? Kleisli category?
- Bazzargh @bazzargh (\n a->liftM ((,) a) (f n a)) ... according to pointfree.io, that's `liftM2 fmap (,) . f` but I can't pretend to get the transformation
- December 29th, 2017:
given f :: a -> b
define g :: [a] -> [Maybe c] -> [(b, c)]
>>> g [1,2,3] [Just 7, Nothing, Just 10]
when f = show
- matt @themattchan
g = catMaybes ... zipWith (fmap . (,) . f)
where (...) = (.).(.)
- garrison @GarrisonLJ g a b = map (f.id***fromJust) . filter (isJust . snd) $ zip a b
- TJ Takei @karoyakani g = (catMaybes .) . zipWith ((<$>) . (,) . f)
- December 29th, 2017: define f :: [(a,b)] -> ([a], [b])
- Андреев Кирилл @nonaem00 and matt @themattchan unzip
- Victoria C @ToriconPrime f = fmap fst &&& fmap snd
- (in a vacuum, a more general type signature would be inferred, but the compiler limits itself as instruct)
Tuesday, January 2, 2018
Friday, December 29, 2017
- November 5th, 2017: f :: Map Int [a] -> [b] - > [(Int, b)]
for, e.g.: f mapping bs
length bs == length (concat (Map.elems mapping))
- Andreas Källberg @Anka213 Using parallel list comprehensions:
f mp bs = [ (k,b) | (k,as) <-assocs mp, a <- as | b <- bs]
- Steve Trout @strout f = zip . foldMapWithKey (fmap . const)
Thursday, November 30, 2017
- November 30th, 2017: For Thursday's #haskell problem we've published our articles to the PostgreSQL database, now let's extract them as JSON. Today's #haskell solution is a simple SQL query and applying some work from previous exercise to fetch and JSONify recommended articles to print!
- November 29th, 2017: For Wednesday's #haskell problem, now that we've selected the recommended articles, let's save that for review to the PostgreSQL database. For today's #haskell solution, we delete the old recommendations-to-be-published, we insert the new set. Voilà!
- November 28th, 2017: Monday we added articles from a PostgreSQL database using #haskell; Tuesday we delete articles. WHEEEEE! Today's #haskell solution shows that deleting article recommendations is very much like adding recommendations, ... in reverse. WHODATHUNK!
- November 27th, 2017: Monday's problem: "It's not rocket science!" Adding articles to a recommendation set in PostgreSQL with #haskell. A little bit of #haskell; a little bit of #PHP and we have an article-adder-webservice ... thingie!
- November 24th, 2017: Friday's #haskell problem: PostgreSQL database, JSON, Haskell: you've got yourself a webservice. Friday's #haskell solution uses the Brief-structure, this time to show article recommendations.
- November 23rd, 2017: For Thursday, a fun little #haskell JSON-y exercise on Thanksgiving Day from the USA to you! Y'know, Nietzsche says: "Out of chaos comes JSON." ... no ... wait.
- November 22nd, 2017: Wednesday's #haskell problem: given a NYT article index, extract the article full text from PostgreSQL. Simple, eh? ... 'maybe.' Full text of NYT articles archived in PostgreSQL as JSON.
- November 21st, 2017: Tuesday's #haskell problem we slim down the article JSON returned from yesterday by providing article briefs. Today's #haskell solution goes from a set of recommendations from NYT articles to briefs.
- November 20th, 2017: Monday's #haskell problem moves keyword/key-phrase-article retrieval and matching to the PostgreSQL database. Today's #haskell solution: we build our keyword-key-phrase dictionary from SQL and filter articles indexing from those keywords.
- November 17th, 2017: Thursday we linked keywords to key-phrases; for Friday's #haskell problem, we'll upload that linkage information to a PostgreSQL data store. Today's #haskell solution stores 26,000+ keywords, with almost 240,000 cross-references into nearly 10,000 NYT articles. Whoa.
- November 16th, 2017: Thursday's #haskell problem: provide a mapping from unique keywords to key-phrases containing them. Mapping keywords to key-phrases, it's what we do for today's #haskell solution.
- November 15th, 2017: Wednesday's #haskell problem is to parse a CSV file of articles to upload to an article MongoDB. Today's #haskell solution has a little bit of CSVing and a little bit of JSONification to upload article information into MongoDB.
- November 14th, 2017: Tuesday's #haskell exercise is a parsing exercise of a different sort: parsing CSV, but with embedded quote within columns! Ooh! We now can parse CSV files with embedded quotes. YES! Adding that to the old CSV parsing library.
- November 13th, 2017: Indexing articles by keyword and then searching articles by keyword for Monday's #haskell problem. For today's #haskell solution we intersect sets of articles to do fast keyword searches.
- November 10th, 2017: Friday's #haskell exercise is to load the keywords and recommended articles into the PostgreSQL database. Thanks to today's #haskell solution we have articles and keyphrases indexed by keyword.
- November 9th, 2017: Thursday's #haskell problem ties NYT article data stored in PostgreSQL together with the recommended articles from JSON. Today's #haskell solution is reading NYT article recommendations from a PostgreSQL database.
- November 8th, 2017: Wednesday's #haskell problem is to combine article recommendations with their key-phrases to output as JSON. Wednesday's #haskell solution: JSON: GET. (p.s. I love Data.Aeson.Encode.Pretty)
- November 7th, 2017: Tuesday's #haskell problem is to parse JSON of NYT articles and their metadata. Today's #haskell solution: we have articles stored as JSON, and, voilà! we materialize those articles!
- November 6th, 2017: Monday's #haskell exercise is to parse a CSV file of recommended articles from the NYT archive. Today's #haskell solution uses the reads-function to guide the parsing of values from a CSV file.
- November 3rd, 2017: Today is Friday! YAY! Do you know what that means? It's PARSING DAY is #haskell-land! YAY! ... no ... wait. What? TIL that parsing keywords and parsing LISTS of keywords can be very different things for today's #haskell solution.
- November 2nd, 2017: Today's #haskell problem: 'Hello, world' in Haskell. Snark on the side FO' FREE! I don't recall Eliza being this snarky, but today's #haskell solution says differently.
- November 1st, 2017: Wednesday #haskell problem is scan a new archive and update the special character file or correct the new archive. The #haskell solution to replacing special characters... WHAT special characters? They GONE! #ETL
Saturday, November 4, 2017
sing [x] = Right x
sing (_ : _) = Left "Too many"
valid = sing . nub
go = _1 valid . unzip
in traverse go