hawk icon indicating copy to clipboard operation
hawk copied to clipboard

Use cases for Hawk

Open melrief opened this issue 12 years ago • 1 comments

I propose to use this issue to put all the interesting problems that can be solved with Hawk that we have in mind and then select the most interesting to show in the readme. I start with some use cases:

  • convert a unix timestamp from/to a readable date: a simple function in Prelude.hs should do the magic
  • convert an integer representing bytes into a readable value, like 28461575 -> 28M: a simple function in Prelude.hs should do the magic
  • highlight some text using a regexp to select it: we need the library to color the output, then it's easy
  • print a range of lines, like from the 3rd to the 11th lines: take (11-3) . drop 3
  • translate based on a dictionary: this is more difficult because we need to load the dictionary...maybe we should add the possibility to take in input more than one file and/or stream and then find a way to work on both of them. This is difficult IMHO...

melrief avatar Aug 21 '13 11:08 melrief

In the readme, I would prefer to focus on uses which don't require a fancy prelude. This way, readers can easily recognize that the expression is ordinary haskell code, which they could write themselves, and then decide that they would indeed like to write haskell from the command-line.

With a complicated prelude, we can make much more impressive demonstrations, but it would demonstrates the flexibility of haskell, not that of hawk. We should, of course, include at least one complicated example in order to demonstrate that a complicated prelude can allow you to add support for anything, but I don't think we should focus on that.

One way in which the prelude could be sensibly demonstrated while focussing on hawk's strengths is by structuring the readme around the various input and output formats supported by hawk. Somebody opened an issue about adding yaml support; after sections titled "list of lines" and"tab-separated tables", we could have a section titled "and every other formats" demonstrating that custom formats such as yaml can easily be added by writing a short snipped it the prelude.

gelisam avatar Aug 21 '13 13:08 gelisam