Favorite non-famous libraries?

I’ll start – I recently began using path and path-io. Being able to talk about Path Abs Dir instead of [Char] is delightful.

11 Likes

overloaded-records or generic-lens coupled with DuplicateRecordFields take Haskell’s record system from being unremittingly awful to being pretty great. These libraries let you access record fields using overloaded labels, even if there are multiple records with the same field name:

data Foo = Foo { bar :: Int, baz :: Int }
data Foo2 = Foo { bar :: Text }

foo = Foo 37 42
foo2 = Foo2 "Foo"

> foo ^. #bar
37
> foo2 ^. #bar
"Foo"
> foo2 & #bar %~ Text.map capitalize
Foo2 "FOO"

At work, I set up an internal library that does the same thing and it is a massive quality of life improvement for working with business domain code.

7 Likes

The row-types library is a nice one for extensible records that I’ve used in libraries and application code. Not something I’d bring in into a work project without being very careful, but for my personal projects it’s been great.

2 Likes

groom is a tiny one to pretty print Show instances without any additional work, loving it http://hackage.haskell.org/package/groom

3 Likes

Interestingly we can’t all agree on a good path type. Here’s a big discussion on it, if you’re interested: https://github.com/Gabriel439/Haskell-Turtle-Library/issues/54

3 Likes

I really like LazySmallCheck2012, an improved version of LazySmallCheck

QuickCheck finds counterexamples through random generation. SmallCheck
finds them through enumeration. LazySmallCheck generates a single,
unevaluated thunk: if that thunk gets forced, it throws an exception and
LazySmallCheck tries again with more specific values (e.g. if the thunk
is _ :: [Bool], it will try again with [] :: [Bool] and
(_:_) :: [Bool]). This:

  • Generates minimal counter-examples (like SmallCheck)
  • Only tests those ‘branches’ of the input space which affect the
    property (i.e. those thunks which get forced)
  • Can tell us when a subexpression was irrelevant (its thunk wasn’t
    forced), e.g. checking fst :: (Bool, Bool) -> Bool will find the
    counterexample (False, _) (unlike SmallCheck’s (False, False))
  • Can prove certain properties hold for all inputs (when no more thunks
    get forced)

The original LazySmallCheck is pretty limited in what it can handle,
whilst the “2012” rewrite can handle much more (e.g. functions).

It’s not on Hackage and seems unmaintained, which is a bit of a shame
( Hackage availability · Issue #11 · UoYCS-plasma/LazySmallCheck2012 · GitHub )

Nevertheless I’ve been happily using it for years :slight_smile:

5 Likes

@warbo have you looked at leancheck? I think it’s the same idea, but on Hackage

Ollie Charles via Haskell Community discourse@haskell.org writes:

@warbo have you looked at leancheck? I think it’s the same idea, but on Hackage

I’ve seen leancheck (but not used it); from what I know it’s roughly the
same idea as SmallCheck rather than LazySmallCheck, i.e. it enumerates
complete values rather than ‘unfolding’ a partial value.

TBH I default to using QuickCheck for most things; but I wouldn’t call
QuickCheck a “non-famous library” :slight_smile:

I feel silly when looking at code that uses complicated mappers where only a bit static escaping would suffice. SQL is still a best DSL for writing structured queries. With some help on a composition side it continues to shine no matter what.

https://bitbucket.org/s9gf4ult/postgresql-query

4 Likes

I like tree-diff package:

It’s not that popular actually. But looks like a lot of work was put into it. I recently used in Haskell packages scaffolding tool called Summoner to compare directory structure including file contents, and it worked like a charm out of the box!

11 Likes

Not sure if it counts as “non-famous” but I recently used dlist - it’s quite useful.

4 Likes

Not famous now, but will surely be in the future: http://hackage.haskell.org/package/generic-data

Especially with 8.6 & derivingVia it is a charm.

3 Likes

I’m not sure if they count as “non-famous” but accelerate and repa (and hip, which can use repa) are definitely underrated.

1 Like

I think uu-parsinglib is the best parsing library on Hackage. It is not very well documented, but it has so much more features than Parsec.

1 Like

I recently discovered these-skinny which I think is a superior alternative to these.

3 Likes

Hi @Tikhon, Can you please show me how you set those two libraries? The result you show is really great but I don’t really know how to start :frowning:
Thanks!

Edited: Never mind, I found it. Thanks for your suggestion. It worked great!

generic-data and generic-data-surgery