Logs: freenode/#haskell
| 2020-11-25 14:28:28 | <honigkuchen> | is there a reason that specifically fits to quicksort, why haskell is here "better" or whatsoever |
| 2020-11-25 14:28:42 | <tdammers> | haskell isn't better at implementing quicksort |
| 2020-11-25 14:28:50 | → | LKoen joins (~LKoen@169.244.88.92.rev.sfr.net) |
| 2020-11-25 14:28:51 | <maerwald> | honigkuchen: https://augustss.blogspot.com/2007/08/quicksort-in-haskell-quicksort-is.html |
| 2020-11-25 14:29:07 | <tdammers> | the famous "quicksort but not quite actually" example is used to demonstrate the elegance of the language |
| 2020-11-25 14:29:16 | × | elliott__ quits (~elliott@pool-108-51-141-12.washdc.fios.verizon.net) (Ping timeout: 240 seconds) |
| 2020-11-25 14:29:22 | → | star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) |
| 2020-11-25 14:30:05 | → | supercoven joins (~Supercove@196.244.192.58) |
| 2020-11-25 14:30:06 | × | supercoven quits (~Supercove@196.244.192.58) (Max SendQ exceeded) |
| 2020-11-25 14:30:20 | <n0042> | merijn: The I/O difficulties I've been having are mostly just getting the hang of the syntax. I've been doing some assignments in Haskell that require using arrays, and the difference in syntax between ones that have to be treated like Monad-like objects and ones that don't is kind of a learning curve. |
| 2020-11-25 14:30:20 | → | supercoven joins (~Supercove@196.244.192.58) |
| 2020-11-25 14:30:21 | × | supercoven quits (~Supercove@196.244.192.58) (Max SendQ exceeded) |
| 2020-11-25 14:30:35 | → | supercoven joins (~Supercove@196.244.192.58) |
| 2020-11-25 14:30:36 | × | supercoven quits (~Supercove@196.244.192.58) (Max SendQ exceeded) |
| 2020-11-25 14:30:50 | → | supercoven joins (~Supercove@196.244.192.58) |
| 2020-11-25 14:30:51 | × | supercoven quits (~Supercove@196.244.192.58) (Max SendQ exceeded) |
| 2020-11-25 14:30:52 | <n0042> | I've been messing with immutable arrays, mutable arrays, and vectors to make my stuff meet the speed requirements (which are contrived and strict) |
| 2020-11-25 14:31:05 | → | supercoven joins (~Supercove@196.244.192.58) |
| 2020-11-25 14:31:06 | × | supercoven quits (~Supercove@196.244.192.58) (Max SendQ exceeded) |
| 2020-11-25 14:31:08 | <merijn> | n0042: ah, yeah, that can be a bit tricky |
| 2020-11-25 14:31:11 | <n0042> | And it has been pretty fun. Haskell is a really fun language. Glad I took the plunge |
| 2020-11-25 14:31:52 | <honigkuchen> | can it make sense to combine python and haskell in one program ? |
| 2020-11-25 14:32:03 | ← | f-a parts (~f-a@151.68.209.164) () |
| 2020-11-25 14:32:32 | <maerwald> | python is used in GHC for the tests :p |
| 2020-11-25 14:32:35 | <maerwald> | does that count? |
| 2020-11-25 14:32:36 | <n0042> | Python is a great "glue" language (I use it for stuff instead of Bash all the time). So I could see myself writing a program in Haskell and then calling it from within a Python script. |
| 2020-11-25 14:32:52 | <merijn> | n0042: tbh, I now consider Haskell a much better glue language :p |
| 2020-11-25 14:33:05 | <LKoen> | honigkuchen: https://github.com/jacquev6/Polyglot |
| 2020-11-25 14:33:09 | <merijn> | n0042: It's incredibly easy to call C code from Haskell |
| 2020-11-25 14:33:35 | <tdammers> | merijn: until that C code isn't reentrant, or takes callbacks, or involves variadic arguments |
| 2020-11-25 14:33:45 | <LKoen> | I once run into someone's code who used a makefile written in R, with code in C, C++, R and python |
| 2020-11-25 14:33:46 | <merijn> | tdammers: Yeah, but that's difficult in C too :p |
| 2020-11-25 14:33:48 | → | geekosaur joins (82659a09@host154-009.vpn.uakron.edu) |
| 2020-11-25 14:33:58 | <merijn> | tdammers: tbh, even the callback one is easy |
| 2020-11-25 14:34:06 | × | bitmapper quits (uid464869@gateway/web/irccloud.com/x-tripsbcbodayyxwv) (Quit: Connection closed for inactivity) |
| 2020-11-25 14:34:25 | <merijn> | Lack of reentrancy is hard, but also problematic in C and variadic arguments can't be used portably anyway, even within C :) |
| 2020-11-25 14:34:59 | <merijn> | tdammers: So at worst it's "no harder than using C from C" :p |
| 2020-11-25 14:35:09 | <merijn> | (which can, admittedly, be pretty hard) |
| 2020-11-25 14:35:45 | × | gproto23 quits (~gproto23@unaffiliated/gproto23) (Ping timeout: 240 seconds) |
| 2020-11-25 14:35:47 | <n0042> | I love the way `readFile` works in Haskell. That's got to be the easiest way to do that ever. |
| 2020-11-25 14:35:48 | <honigkuchen> | lol |
| 2020-11-25 14:35:52 | <merijn> | tdammers: Anyway, I was mostly comparing to, say, the insanity of the FFI of python, Java, etc. which are much more convoluted and painful to use |
| 2020-11-25 14:36:01 | <tdammers> | no argument there :D |
| 2020-11-25 14:36:09 | <merijn> | n0042: Using the one from Prelude that returns String? |
| 2020-11-25 14:36:15 | <n0042> | Yeah |
| 2020-11-25 14:36:38 | ski | . o O ( "Modelling Large Datasets Using Algebraic Datatypes: A Case Study of the CONFMAN Database" by Markus Mottl in 2002-05-15 at <http://www.ofai.at/cgi-bin/get-tr?paper=oefai-tr-2002-27.pdf> ) |
| 2020-11-25 14:37:01 | <merijn> | n0042: Might wanna use Text for reading textual data: https://hackage.haskell.org/package/text-1.2.4.0/docs/Data-Text-IO.html#v:readFile |
| 2020-11-25 14:37:04 | <gentauro> | geekosaur: do you have a multiscreen setup with XMonad? |
| 2020-11-25 14:37:12 | <merijn> | (since you said performance matters) |
| 2020-11-25 14:37:19 | <gentauro> | more specifically, daisy chaining? |
| 2020-11-25 14:37:49 | ski | . o O ( "Using Algebraic Datatypes as Uniform Representation for Structured Data" by Markus Mottl in 2003-03-07 at <http://www.ofai.at/cgi-bin/get-tr?paper=oefai-tr-2003-07.pdf>,<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.13.5712> ) |
| 2020-11-25 14:37:50 | <n0042> | merijn: Thank you very much |
| 2020-11-25 14:38:10 | <tdammers> | also, there's the caveat that readFile does lazy I/O, and that means the actual reading may happen at surprising times |
| 2020-11-25 14:39:07 | <tdammers> | e.g.: do { str <- readFile "foo"; unlink "foo"; putStrLn str } -- this may crash due to trying to read from a deleted file |
| 2020-11-25 14:39:09 | → | Sgeo joins (~Sgeo@ool-18b982ad.dyn.optonline.net) |
| 2020-11-25 14:39:13 | × | darjeeling_ quits (~darjeelin@122.245.219.209) (Ping timeout: 256 seconds) |
| 2020-11-25 14:39:21 | <Boomerang_> | I hear Data.Text.IO is not good if you care about locales |
| 2020-11-25 14:39:26 | <Boomerang_> | https://www.snoyman.com/series/haskell-bad-parts |
| 2020-11-25 14:42:27 | <gentauro> | tdammers: where do you delete the file? `unlink`? |
| 2020-11-25 14:42:32 | <tdammers> | yeah |
| 2020-11-25 14:42:53 | <tdammers> | although I believe on a typical (Linux) filesystem, you have to actually truncate it for that to crash |
| 2020-11-25 14:43:46 | × | chrpape quits (~user@2a01:4f9:c010:632d::1) (Quit: ERC (IRC client for Emacs 25.2.2)) |
| 2020-11-25 14:43:56 | × | Nahra quits (~Nahra@unaffiliated/nahra) (Ping timeout: 240 seconds) |
| 2020-11-25 14:44:09 | <n0042> | Thanks Boomerang. Lots of information in that article. |
| 2020-11-25 14:44:32 | <n0042> | I wasn't aware of some of the pitfalls of `readFile` |
| 2020-11-25 14:44:59 | <gentauro> | tdammers: I recall me doing this -> `readFileStrict f = LBS.readFile f >>= \bs -> LBS.length bs `seq` pure bs` :'( |
| 2020-11-25 14:45:20 | <gentauro> | a strict version cos Linux complained about having to many files open |
| 2020-11-25 14:46:03 | <merijn> | tdammers: Text one doesn't do lazy IO |
| 2020-11-25 14:46:05 | <gentauro> | tdammers: how do you write `seq` in do-nation? |
| 2020-11-25 14:46:09 | <tdammers> | gentauro: why not just LBS.fromStrict <$> BS.readFile f |
| 2020-11-25 14:46:21 | <tdammers> | tdammers: lazy text one does I think |
| 2020-11-25 14:46:44 | <merijn> | Boomerang_: eh, that's wrong |
| 2020-11-25 14:46:51 | → | chrpape joins (~user@2a01:4f9:c010:632d::1) |
| 2020-11-25 14:46:55 | <merijn> | Boomerang_: readFile works fine if your locale isn't broken |
| 2020-11-25 14:47:23 | <merijn> | Boomerang_: readFileUtf8, etc. are dumb hacks that are broken on machines that are setup correctly |
| 2020-11-25 14:47:31 | <tdammers> | readFile does the correct thing: decode raw bytes into Unicode as per the current locale |
| 2020-11-25 14:47:42 | <gentauro> | tdammers: I don't think I have a `strict` ByteString |
| 2020-11-25 14:47:46 | <gentauro> | LBS is `lazy` |
| 2020-11-25 14:47:50 | <merijn> | Boomerang_: They're basically "ignore the local specified encoding and always use utf8", which is bad and anyone doing that should feel bad >.> |
| 2020-11-25 14:48:00 | <tdammers> | gentauro: yes, but you can read a strict bytestring and convert it to lazy |
| 2020-11-25 14:48:02 | × | Fractalis quits (~Fractalis@2601:987:280:8d40:eda9:f9e1:2072:cea7) (Ping timeout: 264 seconds) |
| 2020-11-25 14:48:04 | <gentauro> | «fromStrict :: ByteString -> ByteStringO(1) Convert a strict ByteString into a lazy ByteString.» |
| 2020-11-25 14:48:09 | <merijn> | n0042: ^^ see above :) |
| 2020-11-25 14:48:21 | <gentauro> | tdammers: oh, got it |
| 2020-11-25 14:48:32 | <merijn> | gentauro: lazy bytestring is, effectively, just [Strict.ByteString] :p |
| 2020-11-25 14:49:01 | <merijn> | (i.e. a lazy list of strict chunks) |
| 2020-11-25 14:49:06 | <tdammers> | it's slightly more clever than [ByteString], but yeah, essentially that |
| 2020-11-25 14:49:13 | <gentauro> | merijn: yeah, I got that |
| 2020-11-25 14:49:23 | <n0042> | Luckily I'm only using it to read predictable input right now, so it works pretty well. |
| 2020-11-25 14:49:50 | <tdammers> | anyway, the problem with readFile and locales is when people assume that any file they might possibly want to read from is encoded according to the current locale |
| 2020-11-25 14:50:05 | <tdammers> | which is of course often wrong, but just assuming UTF8 isn't any better |
| 2020-11-25 14:50:11 | → | machinedgod joins (~machinedg@135-23-192-217.cpe.pppoe.ca) |
| 2020-11-25 14:50:30 | hackage | haskell-xmpp 2.0.0 - Haskell XMPP (eXtensible Message Passing Protocol, a.k.a. Jabber) library https://hackage.haskell.org/package/haskell-xmpp-2.0.0 (Jappie) |
| 2020-11-25 14:50:33 | <gentauro> | tdammers: the only way to be 100% is to read the hole file |
| 2020-11-25 14:50:35 | <merijn> | tdammers: Also, people who have badly configured machines with broken locales complaining that they're broken and "fixing" it by breaking it for everyone who *does* have a properly configured locale >.> |
| 2020-11-25 14:51:01 | <Boomerang_> | merijn: I guess it depends on the use case but I think more often I would rather it reported an error if it's not UTF-8 than do something weird instead |
| 2020-11-25 14:51:18 | <merijn> | Boomerang_: It doesn't do anything weird, though |
| 2020-11-25 14:51:36 | <merijn> | Boomerang_: It literallys asks the environment "what is the environment encoding?" and then uses that |
| 2020-11-25 14:52:03 | <merijn> | Boomerang_: If you want explicit control over decoding you can either 1) override the encoding for a handle or 2) read a ByteString and explicitly decode it |
| 2020-11-25 14:52:19 | → | darjeeling_ joins (~darjeelin@122.245.217.23) |
All times are in UTC.