Menu

1 / 2

Beyond AWK: Bringing Haskell into Unix Pipelines

DEV Community: haskell·kohei_wada·5 days ago
#4nwMuAvj
#devtohaskell#devto#dev#enter#exit
Reading 0:00
15s threshold

1. A Problem Born from Daily Developer Life

"I want to use Haskell more in real work."

For any developer who has tasted the beauty of functional programming, this is a heartfelt wish. But the reality is that Haskell gets shunned as "impractical" or "too expensive to introduce," and there are almost no opportunities to use it at work.

Couldn't we at least use Haskell for the small everyday tasks? When you stop and look, a shell pipeline really does resemble function composition.

cat file | grep pattern | sort | uniq

Enter fullscreen mode

Exit fullscreen mode

Pipeline = function composition. The more I sat with that intuition, the more convinced I became that Haskell ought to fit right in.

The AWK Wall

When you want to do something a bit longer than a typical one-liner, AWK comes to mind. But...

"How do you write an array in AWK again?"

"What's the syntax for a for loop...?"

Haven't you ended up wasting time on Google, watching all the fun of shell trickery slip away?

2.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.