Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 989 990 991 992 993 994 995 996 997 998 999 .. 5022
502,152 events total
2020-11-01 15:01:48 <maerwald> Yes, hpath uses ByteString as filepath and doesn't use directory package at all
2020-11-01 15:01:54 <maerwald> Everything is built on top of unix
2020-11-01 15:02:02 <geekosaur> (a "file" can be a "directory", as haskell or applications see it)
2020-11-01 15:02:16 × perrier-jouet quits (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) (Quit: WeeChat 2.9)
2020-11-01 15:02:27 × troydm quits (~troydm@unaffiliated/troydm) (Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset)
2020-11-01 15:02:53 × lazyshrk quits (~lazyshrk@128.199.58.13) (Quit: ZNC 1.8.2 - https://znc.in)
2020-11-01 15:03:18 <dminuoso> Or conversely, a directory *is* a file in unix + derivates.
2020-11-01 15:04:09 <maerwald> separating directory from file is nonsense wrt *filepaths*. The `path` package does that though
2020-11-01 15:04:25 × machinedgod quits (~machinedg@24.105.81.50) (Ping timeout: 240 seconds)
2020-11-01 15:04:38 <Squarism> ok. Ill look into hpath and path
2020-11-01 15:04:45 × hekkaidekapus_ quits (~tchouri@gateway/tor-sasl/hekkaidekapus) (Quit: hekkaidekapus_)
2020-11-01 15:05:00 <dminuoso> Squarism: What's the problem domain
2020-11-01 15:05:08 <maerwald> But you'll get surprising results, since only an actual IO call can tell you whether something is a directory or not and a second later that truth might have changed
2020-11-01 15:05:32 <maerwald> It makes sense for *user input*
2020-11-01 15:05:34 cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd)
2020-11-01 15:05:41 testkiwi joins (54d3314c@gateway/web/cgi-irc/kiwiirc.com/ip.84.211.49.76)
2020-11-01 15:05:41 <maerwald> but you should have a separate type for user input
2020-11-01 15:06:01 <Squarism> just rolling a typical bash-like script. Searching for files grouping them by directory / filename-pattern
2020-11-01 15:06:17 lazyshrk joins (~lazyshrk@128.199.58.13)
2020-11-01 15:06:36 <maerwald> Then you don't really need that on type level. It's enough to have that as constructors
2020-11-01 15:07:04 <maerwald> https://github.com/hasufell/hsfm/blob/master/src/HSFM/FileSystem/FileType.hs#L91
2020-11-01 15:07:12 hekkaidekapus joins (~tchouri@gateway/tor-sasl/hekkaidekapus)
2020-11-01 15:07:21 <maerwald> I'm not sure that was a particularly good idea, but it worked
2020-11-01 15:08:26 × LKoen quits (~LKoen@127.251.88.92.rev.sfr.net) (Remote host closed the connection)
2020-11-01 15:09:32 <maerwald> when it comes to filesystem, you don't really want to store much information in memory, but look at it as late a possible and then you end up not needing much data types anyway
2020-11-01 15:09:54 LKoen joins (~LKoen@127.251.88.92.rev.sfr.net)
2020-11-01 15:10:08 × nbloomf quits (~nbloomf@2600:1700:ad14:3020:c427:c5ca:d62:565b) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-11-01 15:10:37 <maerwald> (and don't go the lazy IO route)
2020-11-01 15:10:52 × hekkaidekapus quits (~tchouri@gateway/tor-sasl/hekkaidekapus) (Remote host closed the connection)
2020-11-01 15:10:54 elfets joins (~elfets@2002:25c9:1760:0:84de:a283:20:112f)
2020-11-01 15:10:59 testkiwi parts (54d3314c@gateway/web/cgi-irc/kiwiirc.com/ip.84.211.49.76) ()
2020-11-01 15:11:05 jumper149 joins (~jumper149@ip185225.wh.uni-hannover.de)
2020-11-01 15:11:14 hekkaidekapus joins (~tchouri@gateway/tor-sasl/hekkaidekapus)
2020-11-01 15:12:00 <Squarism> I try to use haskell instead of bash when doing small ad hoc jobs. Even there well typed things help me.
2020-11-01 15:12:49 <maerwald> well, as long as the types don't lie :)
2020-11-01 15:12:50 × LKoen quits (~LKoen@127.251.88.92.rev.sfr.net) (Remote host closed the connection)
2020-11-01 15:13:02 <maerwald> when they represent outdated filesystem information, they lie
2020-11-01 15:13:25 <dminuoso> In addition, the notion of a "filesystem" is confusing and depends on the implementation.
2020-11-01 15:13:28 <Squarism> splitting a path into directory + filename I feel would be basic functionality. But maybe its not
2020-11-01 15:13:42 <dminuoso> Squarism: Consider what we said earlier
2020-11-01 15:13:47 <dminuoso> directories under linux *are* files
2020-11-01 15:14:05 <dminuoso> And `directory` offers you the functionality to split into basename and filename
2020-11-01 15:14:11 <dminuoso> Using `splitFileName`
2020-11-01 15:14:22 <Squarism> yes yes.
2020-11-01 15:14:34 <dminuoso> To track such information in the type system would be worthless, since by the time you interact with the file system again, it could have changed
2020-11-01 15:14:36 <dminuoso> for instance
2020-11-01 15:14:36 <maerwald> Squarism: you want `dirname`, but a path is agnostic of directory vs filename
2020-11-01 15:14:53 <dminuoso> if you know that `"foo" :: Directory`, the moment you interact with the filesystem again that could no longer be true
2020-11-01 15:15:03 tv joins (~tv@unaffiliated/tv)
2020-11-01 15:15:05 <dminuoso> Maybe someone deleted the directory "foo" and replaced it with a symlink to a non-directory
2020-11-01 15:16:12 <Squarism> dminuoso, you mean this right https://hackage.haskell.org/package/directory ?
2020-11-01 15:16:13 <dminuoso> So all that remains is that "foo" is just a filepath information
2020-11-01 15:16:18 <merijn> All filesystem operations are just TOC-TOU races
2020-11-01 15:16:24 <dminuoso> And that remains true
2020-11-01 15:16:30 <dminuoso> whether "foo" still points at something remains to be seen
2020-11-01 15:16:33 <dminuoso> (or what it points at)
2020-11-01 15:17:06 <dminuoso> So "being a directory" is not a property of the filepath, its a property of the (stateful and concurrent) filesystem.
2020-11-01 15:17:42 <dminuoso> Some of the documentation of `directory` is just misleading
2020-11-01 15:17:55 <maerwald> avoid directory package if you can :p
2020-11-01 15:17:58 <dminuoso> splitFileName splits a path into two paths, one that would describe a directory containing the other.
2020-11-01 15:18:02 <dminuoso> but both are *still* paths
2020-11-01 15:19:01 <maerwald> https://hackage.haskell.org/package/path-0.8.0/docs/Path-Posix.html
2020-11-01 15:19:11 <maerwald> this uses a Dir/File type for paths
2020-11-01 15:19:20 <maerwald> so if you like that misconception, go with that
2020-11-01 15:19:26 × britva quits (~britva@31-10-157-156.cgn.dynamic.upc.ch) (Quit: This computer has gone to sleep)
2020-11-01 15:20:13 <dminuoso> merijn: Somehow I wish we would move to transactional filesystems. :(
2020-11-01 15:20:36 <dminuoso> maerwald: Im curious, why do you dislike `directory`?
2020-11-01 15:20:54 britva joins (~britva@2a02:aa13:7240:2980:fc63:822e:7d74:772d)
2020-11-01 15:20:54 × bjobjo quits (~bjobjo@2a01:79c:cebf:d688::9e6) (Quit: leaving)
2020-11-01 15:20:59 <maerwald> dminuoso: it's too cross-platform
2020-11-01 15:21:25 <maerwald> which usually means most of the functions work most of the time
2020-11-01 15:21:36 <maerwald> and for some subset of scenarios, they don't
2020-11-01 15:21:53 <dminuoso> so if if you're inside that subset, then dont use it?
2020-11-01 15:22:02 <maerwald> https://github.com/haskell/directory/issues/110
2020-11-01 15:22:06 Amras joins (~Amras@unaffiliated/amras0000)
2020-11-01 15:22:06 <maerwald> example
2020-11-01 15:22:32 <geekosaur> you often don't have a say as to whether you're in the subset or not
2020-11-01 15:22:37 <maerwald> more: https://github.com/haskell/directory/issues/109
2020-11-01 15:22:42 <maerwald> hard to predict behavior
2020-11-01 15:22:50 <geekosaur> you gjust get a possibly unpleasant surprise
2020-11-01 15:22:59 <maerwald> knowledge of atomicity is darn important
2020-11-01 15:23:00 <dminuoso> Well, I just like the filepath manipulation API of directory.
2020-11-01 15:23:10 <dminuoso> For filesystem interaction I'd default to unix anyway
2020-11-01 15:23:35 <maerwald> yep, except that doesn't have high-level API like recursive copy or deletion
2020-11-01 15:23:39 <dminuoso> geekosaur: Sure, but that's rather an argument about cross-platform in general
2020-11-01 15:23:49 <dminuoso> (In the sense that cross-platform filesystem interaction is brittle)
2020-11-01 15:24:03 <dminuoso> maerwald: Like I said, I just use it for file*path* manipulation
2020-11-01 15:24:11 <dminuoso> Computing file paths, splitting them, etc
2020-11-01 15:24:19 <dminuoso> Or do you mean `unix`?
2020-11-01 15:24:25 <maerwald> yes
2020-11-01 15:24:26 <hpc> the need for cross-platform filesystem interaction doesn't go away just because windows is bad, in any event
2020-11-01 15:24:37 × plutoniix quits (~q@ppp-223-24-92-161.revip6.asianet.co.th) (Quit: Leaving)
2020-11-01 15:24:53 <merijn> hpc: What, precisely, is the argument for windows being bad?
2020-11-01 15:25:00 <hpc> the linked issues
2020-11-01 15:25:03 × Neo-- quits (~neo@internet-188-198-236-78.narocnik.mobitel.si) (Ping timeout: 260 seconds)
2020-11-01 15:25:15 <maerwald> merijn: file locking is really nuts
2020-11-01 15:25:18 × lagothrix quits (~lagothrix@unaffiliated/lagothrix) (Ping timeout: 268 seconds)
2020-11-01 15:25:20 alp joins (~alp@2a01:e0a:58b:4920:78dd:91ee:d015:a8b2)
2020-11-01 15:25:22 jespada joins (~jespada@90.254.243.98)
2020-11-01 15:25:24 <dminuoso> file locking is nuts in the linux world too

All times are in UTC.