2025/05/02

Newest at the top

2025-05-02 20:54:06 +0200 <monochrom> All implicit params are specified by constraints, i.e., at the same place as class constraints. foo :: (?x :: X, Num a) => a
2025-05-02 20:54:02 +0200 <haskellbridge> <sm> ah: "The intrepid user may notice that HasCallStack is just an alias for an implicit parameter ?callStack :: CallStack. This is an implementation detail and should not be considered part of the CallStack API, we may decide to change the implementation in the future."
2025-05-02 20:53:42 +0200 <EvanR> that's also where reflection comes up stuff like the global config you don't want to pass around (this is different from "a database connection I got later")
2025-05-02 20:53:13 +0200 <monochrom> Do you accept: A type constraint that describes an implicit param?
2025-05-02 20:52:57 +0200 <haskellbridge> <sm> loonycyborg I use it for accessing low level command line flags like --color and --debug
2025-05-02 20:52:40 +0200 <monochrom> I can't count. s/3/4/
2025-05-02 20:52:25 +0200 <haskellbridge> <sm> wait, isn't HasCallStack a type constraint, not an implicit parameter, monochrom ? https://www.stackage.org/haddock/lts-20.20/base-4.16.4.0/GHC-Exception.html#t:CallStack
2025-05-02 20:52:23 +0200 <monochrom> It's basic information theory. If a procedure knows which filename to open, there are only one of 3 reasons: It knows from the source code, it knows from an argument, it knows from I/O, it knows from the black market.
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 +0200weary-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 +0200bilegeek(~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 +0200haskellbridgesm 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 ()