Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,804,007 events total
2025-09-24 08:28:34 arandombit joins (~arandombi@2603:7000:4600:ffbe:15f4:44c6:cf8f:dc61)
2025-09-24 08:28:34 × arandombit quits (~arandombi@2603:7000:4600:ffbe:15f4:44c6:cf8f:dc61) (Changing host)
2025-09-24 08:28:34 arandombit joins (~arandombi@user/arandombit)
2025-09-24 08:29:43 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 244 seconds)
2025-09-24 08:30:18 × fp quits (~Thunderbi@2001:708:20:1406::10c5) (Ping timeout: 256 seconds)
2025-09-24 08:30:43 <jackdk> Network.URI.parseURI . Data.Text.unpack, but be mindful that the parse might fail (it returns Maybe URI)
2025-09-24 08:30:53 merijn joins (~merijn@77.242.116.146)
2025-09-24 08:32:49 × arandombit quits (~arandombi@user/arandombit) (Ping timeout: 244 seconds)
2025-09-24 08:38:30 × chromoblob quits (~chromoblo@user/chromob1ot1c) (Ping timeout: 244 seconds)
2025-09-24 08:39:25 chromoblob joins (~chromoblo@user/chromob1ot1c)
2025-09-24 08:45:31 chele joins (~chele@user/chele)
2025-09-24 08:47:35 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 258 seconds)
2025-09-24 08:51:30 <bwe> jackdk: Thanks, another instance of how to get away with the Maybe :Q.
2025-09-24 08:52:15 gmg joins (~user@user/gehmehgeh)
2025-09-24 08:53:36 × chromoblob quits (~chromoblo@user/chromob1ot1c) (Read error: Connection reset by peer)
2025-09-24 08:53:55 chromoblob joins (~chromoblo@user/chromob1ot1c)
2025-09-24 08:54:02 <jackdk> Use a case expression and decide what you want to do if the parse fails, or use fmap to apply a function on the inside if you have a `Just`
2025-09-24 08:57:05 × tzh quits (~tzh@c-76-115-131-146.hsd1.or.comcast.net) (Quit: zzz)
2025-09-24 08:57:07 Unhammer joins (~Unhammer@user/unhammer)
2025-09-24 08:58:17 <jackdk> Absolute worst case, you can use fromJust, but I've never needed it in nontrivial code
2025-09-24 09:00:40 <Unhammer> hi, in a project linking to odbc.so, I tried upgrading to ghc 9.8.4 from 9.6.7 and everything seems fine with my executable, but when I `stack test`, it rebuilds the lib and then gets an error on trying to build the test with "undefined symbol: SQLPrepareW". What changed in ghc 9.8.4 linking?
2025-09-24 09:01:15 merijn joins (~merijn@77.242.116.146)
2025-09-24 09:02:43 fp joins (~Thunderbi@2001:708:20:1406::10c5)
2025-09-24 09:06:33 Enrico63 joins (~Enrico63@2a0b:e541:10d0:0:9efc:e8ff:fe24:3213)
2025-09-24 09:06:33 <Enrico63> Hi all. I'd like some help with an exercise from https://haskell.mooc.fi/part2#lecture-15-youre-valid-even-without-monads
2025-09-24 09:06:33 <Enrico63> **Could you help me without spoiling the solution entirely?**
2025-09-24 09:06:34 <Enrico63> The exercise is this one: https://github.com/moocfi/haskell-mooc/blob/59735e76d37c5470504be4d64206cd49660e1324/exercises/Set15.hs#L172-L215
2025-09-24 09:06:34 <Enrico63> I think I've correctly implemented these functions
2025-09-24 09:06:34 × Vajb quits (~Vajb@n74ieoy4jxary44nkr2-1.v6.elisa-mobile.fi) (Ping timeout: 248 seconds)
2025-09-24 09:06:35 <Enrico63> ```
2025-09-24 09:06:35 <Enrico63> parseInt :: String -> Validation Arg
2025-09-24 09:06:36 <Enrico63> parseVar :: String -> Validation Arg
2025-09-24 09:06:36 <Enrico63> parseOp :: String -> Validation (Arg -> Arg -> Expression)
2025-09-24 09:06:37 <Enrico63> ```
2025-09-24 09:06:37 <Enrico63> so I can do this
2025-09-24 09:06:38 <Enrico63> ```
2025-09-24 09:06:38 <Enrico63> (<<|>>) = liftA2 (<|>)
2025-09-24 09:06:39 <Enrico63> parseIntOrVar = parseInt <<|>> parseVar
2025-09-24 09:06:39 <Enrico63> ```
2025-09-24 09:06:40 <Enrico63> and I've verified that `parseIntOrVar` does what it should do. Furthemore, if I have 3 strings `op`, `a`, and `b`, I can run
2025-09-24 09:06:40 <Enrico63> ```
2025-09-24 09:06:41 <Enrico63> parseOp op <*> parseIntOrVar a <*> parseIntOrVar b
2025-09-24 09:06:41 <Enrico63> ```
2025-09-24 09:07:44 Vajb joins (~Vajb@n7ndfx3ces7n6jnktab-1.v6.elisa-mobile.fi)
2025-09-24 09:14:09 × CiaoSen quits (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 244 seconds)
2025-09-24 09:14:37 acidjnk joins (~acidjnk@p200300d6e71719544593b070e4f06c0e.dip0.t-ipconnect.de)
2025-09-24 09:18:09 Googulator6 is now known as Googulator
2025-09-24 09:18:45 <__monty__> Enrico63: And what part isn't working?
2025-09-24 09:19:34 arandombit joins (~arandombi@2603:7000:4600:ffbe:15f4:44c6:cf8f:dc61)
2025-09-24 09:19:34 × arandombit quits (~arandombi@2603:7000:4600:ffbe:15f4:44c6:cf8f:dc61) (Changing host)
2025-09-24 09:19:34 arandombit joins (~arandombi@user/arandombit)
2025-09-24 09:24:10 × arandombit quits (~arandombi@user/arandombit) (Ping timeout: 248 seconds)
2025-09-24 09:24:22 <Unhammer> … it's template haskell. If I drop the template haskell from my tests (quickcheck $forAllProperties), the linker error goes away. The quickcheck tests aren't even using that library though :-(
2025-09-24 09:26:23 × shr\ke quits (~shrike@user/shrke:31298) (Ping timeout: 260 seconds)
2025-09-24 09:28:53 × jmcantrell quits (~weechat@user/jmcantrell) (Ping timeout: 265 seconds)
2025-09-24 09:28:58 shr\ke joins (~shrike@user/paxhumana)
2025-09-24 09:28:58 × shr\ke quits (~shrike@user/paxhumana) (Changing host)
2025-09-24 09:28:58 shr\ke joins (~shrike@user/shrke:31298)
2025-09-24 09:29:41 × AlexZenon quits (~alzenon@85.174.180.29) (Quit: ;-)
2025-09-24 09:29:54 × Vajb quits (~Vajb@n7ndfx3ces7n6jnktab-1.v6.elisa-mobile.fi) (Ping timeout: 252 seconds)
2025-09-24 09:30:07 arandombit joins (~arandombi@user/arandombit)
2025-09-24 09:30:40 Vajb joins (~Vajb@n7nfchy4dz4j3x4yypz-1.v6.elisa-mobile.fi)
2025-09-24 09:35:28 × arandombit quits (~arandombi@user/arandombit) (Ping timeout: 255 seconds)
2025-09-24 09:37:36 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 252 seconds)
2025-09-24 09:40:39 <Enrico63> __monty__, my brain, ahah. In the sense that I don't know how to plug those functions together.
2025-09-24 09:42:24 × qqe quits (~qqq@185.54.23.100) (Remote host closed the connection)
2025-09-24 09:45:16 AlexZenon joins (~alzenon@85.174.180.29)
2025-09-24 09:45:16 <__monty__> Enrico63: Plug which functions together to achieve what?
2025-09-24 09:45:29 <Enrico63> That is, given these
2025-09-24 09:45:30 <Enrico63> ```
2025-09-24 09:45:30 <Enrico63> liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
2025-09-24 09:45:31 <Enrico63> (<|>) :: Applicative f => f a -> f a -> f a
2025-09-24 09:45:31 <Enrico63> pure :: Applicative f => a -> f a
2025-09-24 09:45:32 <Enrico63> parseInt :: String -> Validation Arg
2025-09-24 09:45:32 <Enrico63> parseVar :: String -> Validation Arg
2025-09-24 09:45:33 <Enrico63> parseOp :: String -> Validation (Arg -> Arg -> Expression)
2025-09-24 09:45:33 <Enrico63> parseThreeWords :: String -> Validation (String, String, String)
2025-09-24 09:45:34 <Enrico63> ```
2025-09-24 09:45:34 <Enrico63> I don't know how to implement this:
2025-09-24 09:45:35 <Enrico63> ```
2025-09-24 09:45:35 <Enrico63> parseExpression :: String -> Validation Expression
2025-09-24 09:45:36 <Enrico63> ```
2025-09-24 09:45:36 <Enrico63> probably `parseThreeWords` (in my first message I called it `parseExpr`, sorry) is what I've given the wrong signature to..
2025-09-24 09:46:04 × chromoblob quits (~chromoblo@user/chromob1ot1c) (Remote host closed the connection)
2025-09-24 09:46:20 chromoblob joins (~chromoblo@user/chromob1ot1c)
2025-09-24 09:46:26 <tomsmeding> Unhammer: something unrelated with template haskell, but try adding `other-extension: TemplateHaskell` to the components in your cabal file that use the TemplateHaskell extension somewhere in the source files
2025-09-24 09:46:50 <Enrico63> With just `parseInt`, `parseVar`, `parseOp`, I know I can implement `parseExpression`, but then it lacks the check on the number of words in the input string, which should be 3.
2025-09-24 09:46:58 <tomsmeding> Unhammer: it fixed some strange linking error with TH for me at some point; I think it was a different error, but who knows
2025-09-24 09:48:05 <Unhammer> i already had that :-/
2025-09-24 09:48:38 <Unhammer> hm, but what if I put the TH in a lib …
2025-09-24 09:48:50 <__monty__> Enrico63: Don't you need to properly split the String in order to feed the correct bits to parseOp and parseIntOrVar?
2025-09-24 09:49:34 <Enrico63> Yes, and that's what my current implementation of `parseThreeWords` is doing. It takes a single `String`, and gives back a `Validation (String, String, String)`.
2025-09-24 09:49:38 merijn joins (~merijn@77.242.116.146)
2025-09-24 09:50:16 <tomsmeding> what are you supposed to do if the input string has more than 3 words?
2025-09-24 09:50:59 <Enrico63> Still produce an error via `Validation`.
2025-09-24 09:51:27 <tomsmeding> are you allowed to use (>>=) on Validation
2025-09-24 09:51:32 dhil joins (~dhil@5.151.29.141)
2025-09-24 09:51:35 <Enrico63> (Since it's the only exercise left in that batch, I could submit it and then lookup the solutions, but I want to understand first :( )
2025-09-24 09:52:22 <Enrico63> Wait... am I under the mistaken assumption that Validation is not a Monad... ? Let me check. I rember I've explicitly read it is not.
2025-09-24 09:53:10 <tomsmeding> well if splitting is a partial operation (String -> Validation (String,String,String)) and parsing individual components also is (String -> Validation Arg), then you ain't gonna put them together without (>>=)

All times are in UTC.