2026/01/05

Newest at the top

2026-01-05 02:48:33 +0100humasect(~humasect@dyn-192-249-132-90.nexicom.net) (Ping timeout: 260 seconds)
2026-01-05 02:47:19 +0100geekosaur-o geekosaur
2026-01-05 02:47:03 +0100geekosaur-r
2026-01-05 02:46:51 +0100 <oats> gotcha, thanks
2026-01-05 02:46:43 +0100ChanServ+o geekosaur
2026-01-05 02:46:10 +0100 <c_wraith> and @undo doesn't give you what GHC does. It is an independent reimplementation of the rules from the Haskell report.
2026-01-05 02:45:37 +0100 <c_wraith> technically they are, but not in a way that influences semantics. There are some performance optimizations.
2026-01-05 02:45:00 +0100 <oats> oh I was just trying out desugaring list comprehensions, because I thought I remembered someone telling me they were special to ghc in some way
2026-01-05 02:44:28 +0100merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds)
2026-01-05 02:44:16 +0100 <c_wraith> [ x | x <- foo ] as opposed to do { x <- foo ; pure x }
2026-01-05 02:43:57 +0100humasect(~humasect@dyn-192-249-132-90.nexicom.net) humasect
2026-01-05 02:43:53 +0100 <oats> ?
2026-01-05 02:43:22 +0100 <c_wraith> You don't have to write pure. :)
2026-01-05 02:42:56 +0100 <oats> don't remember who told me that
2026-01-05 02:42:53 +0100 <oats> interesting, I thought list comprehensions were special in some way
2026-01-05 02:42:43 +0100 <int-e> oats: Int (machine word sized), yes.
2026-01-05 02:42:34 +0100 <lambdabot> concatMap (\ a -> case a of { Just x -> [x]; _ -> []}) [Just 1, Nothing]
2026-01-05 02:42:34 +0100 <oats> @undo [x | Just x <- [Just 1, Nothing] ]
2026-01-05 02:42:25 +0100 <Axman6> and fail str = [] for []
2026-01-05 02:41:45 +0100 <oats> int-e: I'm not super clear on #, that's an unboxed integer right?
2026-01-05 02:41:37 +0100 <lambdabot> [Just 1, Nothing] >>= \ a -> case a of { Just x -> pure x; _ -> fail ""}
2026-01-05 02:41:37 +0100 <int-e> @undo do { Just x <- [Just 1, Nothing]; pure x }
2026-01-05 02:41:31 +0100 <c_wraith> the report actually specifies that.
2026-01-05 02:41:05 +0100 <oats> wonder what that desugars to
2026-01-05 02:40:33 +0100 <yahb2> [1]
2026-01-05 02:40:33 +0100 <oats> % do { Just x <- [Just 1, Nothing]; pure x }
2026-01-05 02:39:13 +0100 <yahb2> [1,2,3,4,6,7,8,9,10]
2026-01-05 02:39:13 +0100 <oats> % do { x <- [1..10]; if (x == 5) then fail "bleh" else pure (); pure x }
2026-01-05 02:38:49 +0100 <haskellbridge> <loonycyborg> case is one of few constructs that aren't syntactic sugar for something else.
2026-01-05 02:38:11 +0100 <int-e> So up to that point, `case` was the only way to do this. `case` is also clearer about the order of operations.
2026-01-05 02:38:10 +0100 <c_wraith> there are also things like GADT matching, where GHC just won't compile code that matches a GADT constructor in a let/where
2026-01-05 02:37:25 +0100merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) merijn
2026-01-05 02:37:12 +0100 <int-e> oats: as recently as GHC 8.8.4, ghc would choke on `let i = 1#` (with or without bang)
2026-01-05 02:37:06 +0100 <haskellbridge> <loonycyborg> Those seem to be really different things though, so it smells like some theoretical insight here could be made..
2026-01-05 02:35:13 +0100 <haskellbridge> <loonycyborg> but ye, irrefutable and lazy are connected.
2026-01-05 02:35:01 +0100 <yahb2> <interactive>:159:5: warning: [GHC-53633] [-Woverlapping-patterns] ; Pattern match is redundant ; In a pattern binding: Just x = ... ; ; *** Exception: <interactive>:159:5-35: Non-exhausti...
2026-01-05 02:35:01 +0100 <oats> % let Just x = (Nothing :: Maybe Int) in x
2026-01-05 02:34:47 +0100 <oats> %let Just x = (Nothing :: Maybe Int) in x
2026-01-05 02:34:30 +0100 <c_wraith> If it's on the left side of <- in a do block, yes
2026-01-05 02:34:16 +0100 <haskellbridge> <loonycyborg> Sometimes should be converted into "fail"
2026-01-05 02:34:02 +0100 <c_wraith> yeah, just the usual error about a pattern match failure
2026-01-05 02:33:45 +0100 <haskellbridge> <loonycyborg> Same thing as usual?
2026-01-05 02:33:33 +0100 <haskellbridge> <loonycyborg> and what happens in case of non-exhaustive match at runtime?
2026-01-05 02:33:17 +0100 <haskellbridge> <loonycyborg> Ah makes sense I guess
2026-01-05 02:32:14 +0100 <c_wraith> loonycyborg: You need the BangPatterns extension, then you mark the match with !
2026-01-05 02:31:49 +0100 <haskellbridge> <loonycyborg> Like you said they're irrefutable "by default"
2026-01-05 02:31:47 +0100 <haskellbridge> <loonycyborg> How can you make patterns in let and where refutable?
2026-01-05 02:30:33 +0100 <int-e> c_wraith: yes
2026-01-05 02:29:56 +0100 <c_wraith> Yeah. "irrefutable" is a slightly weird way of saying "trust the programmer, you don't need to check this immediately"
2026-01-05 02:29:49 +0100 <oats> t'would appear