Newest at the top
2025-05-02 20:52:16 +0200 | <EvanR> | a more object oriented way to do this is when you connect to the database, it returns to you a record of database accessing routines which close over the connection |
2025-05-02 20:52:16 +0200 | weary-traveler | (~user@user/user363627) (Remote host closed the connection) |
2025-05-02 20:52:12 +0200 | <haskellbridge> | <loonycyborg> I think it would be acceptable to access global constants, but not variables. |
2025-05-02 20:51:41 +0200 | <hellwolf> | it's friday |
2025-05-02 20:51:15 +0200 | <EvanR> | I feel like you're trolling the channel now |
2025-05-02 20:50:59 +0200 | <haskellbridge> | <Liamzee> {-# NOINLINE liamIsGoingToHell #-} |
2025-05-02 20:50:43 +0200 | <EvanR> | which is why it's tricky |
2025-05-02 20:50:34 +0200 | <EvanR> | which it doesn't in the case of global refs |
2025-05-02 20:50:11 +0200 | <haskellbridge> | <loonycyborg> unsafePerformIO is ok if you can prove that it always actually returns the same thing |
2025-05-02 20:50:04 +0200 | <hellwolf> | you need to go to a ayahuasca session and puke all your imperative toxic out. |
2025-05-02 20:50:02 +0200 | <EvanR> | your library actions need to know which connection to use |
2025-05-02 20:49:56 +0200 | <monochrom> | That is also true. |
2025-05-02 20:49:56 +0200 | <haskellbridge> | <Liamzee> although tbh I feel like doing it because it's transgressive and i'm an edgelord |
2025-05-02 20:49:47 +0200 | <haskellbridge> | <Liamzee> only unsafePerformIO can relieve me from parameter passing? |
2025-05-02 20:49:28 +0200 | <monochrom> | Only parameter passing can relieve you from unsafePerformIO. |
2025-05-02 20:49:11 +0200 | <monochrom> | Yeah IVar does not relieve you from unsafePerformIO. |
2025-05-02 20:49:10 +0200 | <EvanR> | they are |
2025-05-02 20:49:03 +0200 | <haskellbridge> | <sm> implicit params hurt my brain. They feel like arguments by another name |
2025-05-02 20:48:51 +0200 | <haskellbridge> | <Liamzee> hummm, crap, this is unsafePerformIO shenanigans |
2025-05-02 20:48:49 +0200 | bilegeek | (~bilegeek@2600:1008:b01d:f38b:e9d6:efbc:7794:17cd) bilegeek |
2025-05-02 20:48:40 +0200 | <EvanR> | global variables are bad mkay |
2025-05-02 20:48:24 +0200 | <monochrom> | i.e., if you write "foo :: HasCallStack => ()" it becomes "foo :: ?callStack :: CallStack => Int" so the stack is an implicit param. |
2025-05-02 20:48:20 +0200 | <EvanR> | ... |
2025-05-02 20:48:11 +0200 | <haskellbridge> | <Liamzee> the ivar is global scoped in the library |
2025-05-02 20:48:08 +0200 | <EvanR> | IVar is good when you have a value that is not yet known and your evaluation can wait |
2025-05-02 20:48:05 +0200 | <haskellbridge> | <Liamzee> that loads the config |
2025-05-02 20:47:57 +0200 | <haskellbridge> | <Liamzee> writing to an ivar |
2025-05-02 20:47:52 +0200 | <haskellbridge> | <Liamzee> initialize the functions by calling a function calling an ivar |
2025-05-02 20:47:40 +0200 | <monochrom> | type HasCallStack = ?callStack :: CallStack |
2025-05-02 20:47:34 +0200 | <haskellbridge> | <Liamzee> IVar |
2025-05-02 20:47:30 +0200 | <haskellbridge> | <Liamzee> you know what |
2025-05-02 20:47:22 +0200 | <hellwolf> | "05-02 21:46 [haskellbridge sm contemplates]" <-- if someone is named "is" that'd be a funny IRC message. |
2025-05-02 20:46:50 +0200 | haskellbridge | sm contemplates |
2025-05-02 20:46:36 +0200 | <hellwolf> | is he spiritually here? |
2025-05-02 20:46:23 +0200 | <haskellbridge> | <Liamzee> he's already here |
2025-05-02 20:46:20 +0200 | <monochrom> | I mean that HasCallStack is implemented as an implicit param. |
2025-05-02 20:46:12 +0200 | <hellwolf> | CC @sm who recently mentioned some pay related to HasCallStack |
2025-05-02 20:45:59 +0200 | <EvanR> | so you want to somehow avoid passing in the database connection everywhere |
2025-05-02 20:45:45 +0200 | <hellwolf> | oh, you can use implicit param for HasCallStack? |
2025-05-02 20:45:14 +0200 | <monochrom> | So far I have only needed implicit param for HasCallStack. That one looks like a good use case. But yeah I haven't seen another good use case. |
2025-05-02 20:45:10 +0200 | <haskellbridge> | <sm> if you want to go straight to https://academy.fpblock.com/blog/2017/06/readert-design-pattern you can |
2025-05-02 20:45:08 +0200 | <EvanR> | Config -> IO () |
2025-05-02 20:45:01 +0200 | <haskellbridge> | <Liamzee> fyi, the level of library simplicity i want is to be able to use a single 🍅 emoji to call the database accessor functions |
2025-05-02 20:44:56 +0200 | <hellwolf> | that'd make you happy? |
2025-05-02 20:44:53 +0200 | <hellwolf> | maybe you need a ConfigT |
2025-05-02 20:44:46 +0200 | <hellwolf> | yea, transformers |
2025-05-02 20:44:40 +0200 | chele | (~chele@user/chele) (Remote host closed the connection) |
2025-05-02 20:44:36 +0200 | <EvanR> | reflection and implicit parameters and ReaderT and ... and ... are all forms of "pass in an argument" |
2025-05-02 20:44:32 +0200 | <hellwolf> | but I knew of it and people using it for a yet another kind of effect system. |
2025-05-02 20:44:17 +0200 | <hellwolf> | I am not a "fan" of it, because I don't understand why its needed. |