Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-19 20:01:53 <geekosaur> :t let xyz a b = a + b in (`xyz` 3)
2021-03-19 20:01:55 <lambdabot> Num a => a -> a
2021-03-19 20:02:41 <monochrom> Unlikely to work if f:Int->Bool for example. But let me check:
2021-03-19 20:02:45 <glguy> Shiranai: if f :: a -> b, then we're free to pick b to be (c -> d), so f could be used :: a -> c -> d
2021-03-19 20:02:49 <[exa]> Shiranai: even if `f` seems to accept 1 parameter, the expression will just unify the type `b` to be some instance of `(x->y)`
2021-03-19 20:03:16 <monochrom> @type let {f :: Int -> Bool; f x = x>4 } in (`f` undefind)
2021-03-19 20:03:18 <lambdabot> error:
2021-03-19 20:03:18 <lambdabot> • Variable not in scope: undefind
2021-03-19 20:03:18 <lambdabot> • Perhaps you meant ‘undefined’ (imported from Prelude)
2021-03-19 20:03:23 <monochrom> @type let {f :: Int -> Bool; f x = x>4 } in (`f` undefined)
2021-03-19 20:03:25 <lambdabot> error:
2021-03-19 20:03:25 <lambdabot> • Couldn't match expected type ‘t0 -> t’ with actual type ‘Bool’
2021-03-19 20:03:25 <lambdabot> • The operator ‘f’ takes two arguments,
2021-03-19 20:03:30 <monochrom> That.
2021-03-19 20:03:53 <monochrom> But what glguy said about when f:Int->(Char->Bool)
2021-03-19 20:04:31 <monochrom> Sorry I keep writing : for :: because lately I've been doing normal math/cs :)
2021-03-19 20:04:35 <monochrom> I mean ::)
2021-03-19 20:04:43 apache8080 joins (~rishi@wsip-70-168-153-252.oc.oc.cox.net)
2021-03-19 20:05:08 ixian joins (~mgold@terra.bitplane.org)
2021-03-19 20:05:33 <[exa]> man, your eyes
2021-03-19 20:05:35 <[exa]> O O
2021-03-19 20:05:36 <[exa]> O_O
2021-03-19 20:05:50 <Shiranai> I'm confused, ok so b in f :: a -> b unifies to (c -> d) but I'm not sure if the input is in the left or in the right side
2021-03-19 20:06:18 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-03-19 20:06:23 <monochrom> I wear glasses. In Hong Kong, we who wear glasses are nicknamed as "four-eye people". ::) is exactly right. >::)
2021-03-19 20:06:34 <Shiranai> in geekosaur examples, is (`xys` 3) a equal to a + 3 or 3 + a?
2021-03-19 20:06:36 <[exa]> Shiranai: the input is the "right side" so the second argument. Compare (1 `f`) vs (`f` 1)
2021-03-19 20:06:53 <monochrom> f::a->c->d
2021-03-19 20:07:15 petersen joins (~petersen@redhat/juhp)
2021-03-19 20:07:15 <geekosaur> you can even test this, use (-) instead of (+) so it's obvious which side is which
2021-03-19 20:07:19 <monochrom> (`f` x) = \w -> f w x. Just always use that.
2021-03-19 20:07:30 <geekosaur> at least with the right choice of inputs
2021-03-19 20:07:40 <[exa]> Shiranai: (1 `f`) is the same as (f 1), (`f` 1) is the same as \a -> f a 1 , a.k.a. \a -> a `f` 1
2021-03-19 20:07:41 <Shiranai> thanks monochrom, that's more clear for me
2021-03-19 20:07:48 × tsaka__ quits (~torstein@athedsl-4491541.home.otenet.gr) (Ping timeout: 246 seconds)
2021-03-19 20:07:54 <monochrom> :)
2021-03-19 20:07:57 <Shiranai> Thanks everyone, I think I got it
2021-03-19 20:07:57 × emmanuel_erc quits (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) (Read error: Connection reset by peer)
2021-03-19 20:08:03 tsaka__ joins (~torstein@2a02:587:1b1f:ea00:14f6:46df:d372:9bfc)
2021-03-19 20:08:11 emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com)
2021-03-19 20:09:02 <[exa]> btw, you can compare it with `flip`, sometimes the syntax is useful for avoiding unnecessary flipping.
2021-03-19 20:09:10 <d34df00d> What you're gonna do if your code behaves fine (albeit slowly) under profiler, but explodes with enormous memory consumption when compiled without profiling and with optimizations?
2021-03-19 20:09:44 × ixian quits (~mgold@terra.bitplane.org) (Ping timeout: 240 seconds)
2021-03-19 20:09:47 <[exa]> d34df00d: does it get triggered by "optimizations on" or "profiling off" ?
2021-03-19 20:10:37 × motersen quits (~user@cgn-89-1-214-72.nc.de) (Read error: Connection reset by peer)
2021-03-19 20:10:40 × fragamus quits (ac3a5c66@172.58.92.102) (Quit: Connection closed)
2021-03-19 20:10:59 <d34df00d> I think it's both.
2021-03-19 20:11:03 × Vadrigar quits (~Vadrigar@ip5b417208.dynamic.kabel-deutschland.de) (Quit: WeeChat 2.9)
2021-03-19 20:11:21 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 264 seconds)
2021-03-19 20:11:26 <d34df00d> Hmm, actually hold on. I think it's "profiling off". Just added {-# OPTIONS_GHC -O0 #-} to the offending file, and it still explodes, but slowly.
2021-03-19 20:12:08 <d34df00d> Sadly, I don't have a minimal enough reproducing example. Luckily, the leak started happening after I changed this type and function:
2021-03-19 20:12:16 <d34df00d> https://bpaste.net/WZBA
2021-03-19 20:12:28 <d34df00d> (where VB is the usual boxed Data.Vector and V is Data.Vector.Unboxed)
2021-03-19 20:12:53 <d34df00d> Sooo, that didn't leak, and I changed that to this:
2021-03-19 20:13:00 <d34df00d> https://bpaste.net/57NA
2021-03-19 20:13:04 <d34df00d> and it started leaking.
2021-03-19 20:13:23 <d34df00d> Oh the almighty gurus of #haskell, can you spot anything that might trigger it here?
2021-03-19 20:14:03 <[exa]> if it's that functino, I'd just try making it strict (there's no reason not to imho)
2021-03-19 20:14:19 <d34df00d> Ah, right, I have {-# LANGUAGE Strict #-}
2021-03-19 20:14:23 × viluon quits (uid453725@gateway/web/irccloud.com/x-tsrjyctedjmnhhpa) (Quit: Connection closed for inactivity)
2021-03-19 20:14:32 × ph88 quits (~ph88@2a02:8109:9e00:7e5c:342c:fb5e:4a48:8cb) (Ping timeout: 240 seconds)
2021-03-19 20:17:31 <[exa]> hm okay, that's gonna be interesting.
2021-03-19 20:17:59 chenshen joins (~chenshen@2620:10d:c090:400::5:a8c8)
2021-03-19 20:18:16 <Shiranai> Not specific to haskell but is there any guide on making a haskellish language? With the functional niceties such as first class functions, pattern matching and type inference
2021-03-19 20:19:13 <d34df00d> Stephen Diehl had a series on building haskell in haskell, I guess you could take a few ideas from there.
2021-03-19 20:19:15 <[exa]> Shiranai: Simon Peyton Jones papers :] and if you google for Stephen Diehl, he was collecting some kind of "make you a haskell" howto
2021-03-19 20:19:22 <ephemient> iphy: assuming you're talking about protocol buffer varint, they're encoded little-endian (least-significant first). so isn't that backwards?
2021-03-19 20:19:57 <[exa]> Shiranai: about SPJ papers-- the common reads are "typing haskell in haskell" and the paper about "STG" that I forgot the name of
2021-03-19 20:20:30 × Sathiana quits (~kath@185-113-98-38.cust.bredband2.com) (Quit: WeeChat 3.0)
2021-03-19 20:21:48 <Shiranai> d34df00d: do you mean this http://dev.stephendiehl.com/fun/ ? seeems he saldy stopped writing in just before pattern matching :(
2021-03-19 20:22:07 × molehillish quits (~molehilli@2600:8800:8d06:1800:e0d0:506b:db48:8ec8) (Remote host closed the connection)
2021-03-19 20:22:42 <d34df00d> Yep, that's the one.
2021-03-19 20:22:46 molehillish joins (~molehilli@2600:8800:8d06:1800:e0d0:506b:db48:8ec8)
2021-03-19 20:23:21 <geekosaur> https://www.microsoft.com/en-us/research/publication/implementing-lazy-functional-languages-on-stock-hardware-the-spineless-tagless-g-machine/ ?
2021-03-19 20:23:34 <d34df00d> Pls don't do any more lazy languages.
2021-03-19 20:23:42 ixian joins (~mgold@2002:4a74:ba78:1701:0:ff:fe78:6269)
2021-03-19 20:24:15 <geekosaur> this as you're apparently getting bitten by too much strictness?
2021-03-19 20:24:22 <Shiranai> haha why? But yeah I don't plan on making it lazy, I kinda not like that that much
2021-03-19 20:24:38 <Shiranai> geekosaur: Thanks, I'll check that too
2021-03-19 20:24:53 <d34df00d> I'm getting bitten by laziness all the time.
2021-03-19 20:25:08 <d34df00d> Non-strict evaluation model just gives me all sorts of pain.
2021-03-19 20:25:18 <Shiranai> I have no idea what and STG is but I suppose it'll be useful at some point
2021-03-19 20:25:39 <geekosaur> it's the evaluation engine underneath ghc's haskell implementation
2021-03-19 20:26:12 <Shiranai> my main interest is in logic so I don't see at least any benefit (from a logic point of view) of lazyness, just wanted to write a primitive recursive arithmetic language for fun
2021-03-19 20:26:47 <d34df00d> I guess the type systems you care about in logic don't care about evaluation order (largely because they all strongly normalize)
2021-03-19 20:27:30 × geekosaur quits (82650c7a@130.101.12.122) (Quit: Connection closed)
2021-03-19 20:27:31 <d34df00d> And you don't care about performance because the code isn't intended to run.
2021-03-19 20:28:04 <d34df00d> I guess I should just return to proving things in agda instead of trying to make things run fast in haskell.
2021-03-19 20:28:07 <Shiranai> exactly, I do intend to run it this time, wonder how slow this stuff will be
2021-03-19 20:28:08 × ixian quits (~mgold@2002:4a74:ba78:1701:0:ff:fe78:6269) (Ping timeout: 240 seconds)
2021-03-19 20:28:08 × emmanuel_erc quits (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) (Read error: Connection reset by peer)
2021-03-19 20:28:17 emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com)
2021-03-19 20:28:48 × apache8080 quits (~rishi@wsip-70-168-153-252.oc.oc.cox.net) (Ping timeout: 246 seconds)
2021-03-19 20:28:55 <maerwald> Not all haskellers value laziness that much
2021-03-19 20:29:09 Gigabitten joins (~Somn@098-127-002-172.res.spectrum.com)
2021-03-19 20:31:18 ixian joins (~mgold@terra.bitplane.org)
2021-03-19 20:31:20 <maerwald> I'd much rather have a dumb optimizer that I can reason about as opposed to a very smart one that I have to treat like a crazy oracle
2021-03-19 20:31:46 × Mrbuck quits (~Mrbuck@gateway/tor-sasl/mrbuck) (Quit: WeeChat 2.8)
2021-03-19 20:31:47 <[exa]> this sounds like you've assigned ghc to the latter category
2021-03-19 20:32:03 × Codaraxis quits (~Codaraxis@193.27.14.10) (Remote host closed the connection)

All times are in UTC.