2026/01/05

Newest at the top

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
2026-01-05 02:29:40 +0100 <yahb2> *** Exception: Prelude.undefined ; ; HasCallStack backtrace: ; undefined, called at <interactive>:157:6 in interactive:Ghci16
2026-01-05 02:29:40 +0100 <oats> % case undefined of ~(a,b) -> b
2026-01-05 02:29:09 +0100 <oats> and irrefutable patterns are lazy?
2026-01-05 02:28:50 +0100 <c_wraith> int-e: ah, you're still running lambdabot? I wasn't sure.
2026-01-05 02:28:40 +0100 <int-e> (lamdbabot was perfectly alive, just not joined here)
2026-01-05 02:28:39 +0100jj_jj
2026-01-05 02:28:39 +0100jj(~apropos@d154-20-120-135.bchsia.telus.net) (Ping timeout: 244 seconds)
2026-01-05 02:28:11 +0100 <int-e> it probably got blocked by +r
2026-01-05 02:28:00 +0100 <yahb2> *** Exception: Prelude.undefined ; ; HasCallStack backtrace: ; undefined, called at <interactive>:155:6 in interactive:Ghci16
2026-01-05 02:28:00 +0100 <oats> % case undefined of (a,b) -> ()
2026-01-05 02:27:59 +0100jj_(~apropos@node-1w7jr9pqogh9vahu1mvneock5.ipv6.telus.net) omentic
2026-01-05 02:27:35 +0100 <lambdabot> ()
2026-01-05 02:27:34 +0100 <c_wraith> > case undefined of ~(a, b) -> () -- you can use ~ to make a match in a case irrefutable
2026-01-05 02:26:26 +0100 <EvanR> wow
2026-01-05 02:26:15 +0100merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2026-01-05 02:25:00 +0100divlamir(~divlamir@user/divlamir) divlamir
2026-01-05 02:24:57 +0100 <c_wraith> EvanR: Irrefutable matches just create thunks. and in a let/where, matches are irrefutable by default.
2026-01-05 02:24:49 +0100divlamir(~divlamir@user/divlamir) (Read error: Connection reset by peer)