Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Haskell definitely takes the cake in terms of leveraging parser combinators, but you’re still stuck with Haskell to deal with the result.


That's what they call a "win-win".


For some of us, "being stuck with Haskell" isn't a problem.


For the rest, being stuck with real-world problems instead of self-inflicted ones is preferable :-)


Doesn't seems so, otherwise the computing world wouldn't be so full of NIH syndrome. :)


re-inventing known language features in inferior languages isn't more real-world, it's a self-inflicting kool-aid thirst ^_^


Has Cabal been fixed yet?


Yes, a long time ago [0]. Depending on your needs, stack might still have advantages as the direct tool used by the developer (as it uses cabal underneath anyway).

[0] https://stackoverflow.com/a/51016806/4126514


At least since August 2017: https://downloads.haskell.org/~cabal/Cabal-3.0.0.0/doc/users...

You don't need switching to Stack (as other commenters suggest) to have isolated builds and project sandboxes etc. If you want to bootstrap a specific compiler version, a-la nvm/pyenv/opam, use GHCup with Cabal project setup: https://www.haskell.org/ghcup/



I like haskell a lot, but it's not like there's any shortage of reasons why people don't use it. Replicating parser-combinators in other languages is a huge win.


As someone who really enjoys Haskell, I used to think like that. But I realized for problems like parsing, it really is just excellent.


don't make it sound as if it's bad, it's actually superb on all these levels: the typelevel, the SMP runtime, and throughput.


$ echo "Haskell" | sed 's/ke/-ki'

Has-kill

$


| sed '/k/sk'

Has-skill

$


Write the full transform in Haskell?


    {-# LANGUAGE OverloadedStrings #-}

    import Prelude hiding (putStrLn)
    import Data.Text (Text, replace)
    import Data.Text.IO (putStrLn)

    transform :: Text -> Text
    transform = replace "k" "sk" . replace "ke" "-ki" 

    main :: IO ()
    main = putStrLn $ transform "Haskell"


Since the original sed command took "Haskell" as standard input, why not:

  {-# LANGUAGE OverloadedStrings #-}

  import qualified Data.Text as T
  import qualified Data.Text.IO as T

  main :: IO ()
  main = T.interact (T.replace "k" "sk" . T.replace "ke" "-ki")


Didn't think to, but that looks very slick!


Looks good to me, even as a Haskell ignoramus. I had tried it long back, but found it tough at the time.

What is the reason for hiding the putStrLn of Prelude and importing that of Data.Text.IO?


Prelude takes a `String`, Data.Text.IO works with `Text`. Strings are linked lists of of chars, Text is a more traditional data structure. I tend to write small scripts and use Strings more, but Text is much more efficient for big blocks of text (unsurprisingly). The main reason I used it here was because I couldn't find a `replace` function for `String`, lol.


Thanks.


  sed: -e expression #1, char 5: unterminated `s' command
It's like this:

  sed 's/find/replace/'


Whoops, it was a typo. I do know how to use the sed command, at least the basics; see my previous use of it ( https://news.ycombinator.com/item?id=42084984 ). But thanks, good catch.


HN "bros" (in the ugliest sense of the word "bro") showing their sick nature by viciously downvoting a perfectly innocuous comment.

Seems like many of them have nothing better to do, probably because of layoffs and statistics and linear algebra and 'predicting the next token' (hee hee) in the input, based on gigantic corpuses of data, masquerading as "AI", and many of those bros were/are worthless anyway.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: