Newest at the top
| 2026-04-13 18:11:58 +0000 | <janus> | oh well, you get the idea |
| 2026-04-13 18:11:50 +0000 | <yahb2> | <interactive>:13:34: error: [GHC-76037] ; Not in scope: type constructor or class ‘Word8’ ; Suggested fix: Perhaps use ‘Word’ (imported from Prelude) |
| 2026-04-13 18:11:50 +0000 | <janus> | % getIor (Ior 0xab <> Ior 0x12) :: Word8 |
| 2026-04-13 18:11:40 +0000 | <yahb2> | <no output> |
| 2026-04-13 18:11:40 +0000 | <janus> | % import Data.Bits |
| 2026-04-13 18:11:16 +0000 | <janus> | gentauro: have you seen Data.Bits.Ior? |
| 2026-04-13 18:10:27 +0000 | peterbecich | (~Thunderbi@71.84.33.135) peterbecich |
| 2026-04-13 18:07:30 +0000 | <EvanR> | and record inspection extracts the bits |
| 2026-04-13 18:07:10 +0000 | <EvanR> | yeah this is the "configuration monoid" pattern where the monoid op is OR |
| 2026-04-13 18:06:46 +0000 | r1bilski | (~r1bilski@user/r1bilski) r1bilski |
| 2026-04-13 18:06:06 +0000 | <mauke> | let info@debug@warning = True; logger = def{..} |
| 2026-04-13 18:05:26 +0000 | <EvanR> | pattern Warning = 0x4 |
| 2026-04-13 18:05:09 +0000 | <EvanR> | Info .|. Debug .|. Warning, where these are pattern synonyms |
| 2026-04-13 18:05:02 +0000 | gentauro | define sum type. Derive `Bounded and Enum` (however Bounded needs to be powers of 2) |
| 2026-04-13 18:04:59 +0000 | <mauke> | let logger = defaultLogger{ info = True, debug = True, warning = True } |
| 2026-04-13 18:04:51 +0000 | <janus> | i think many see the Enum class as legacy? that might mean that many people refrain from trying to improve it |
| 2026-04-13 18:04:45 +0000 | Milan_Vanca | (~milan@user/Milan-Vanca:32634) (Quit: WeeChat 4.7.2) |
| 2026-04-13 18:04:14 +0000 | <gentauro> | EvanR: got it |
| 2026-04-13 18:04:11 +0000 | dumptruckman | (~dumptruck@172-104-5-126.ip.linodeusercontent.com) |
| 2026-04-13 18:03:50 +0000 | <gentauro> | it's really useful to use. Ex: `let logger = Info | Debug | Warning` |
| 2026-04-13 18:03:48 +0000 | <EvanR> | bits class |
| 2026-04-13 18:03:43 +0000 | <lambdabot> | Bits a => a -> a -> a |
| 2026-04-13 18:03:42 +0000 | <EvanR> | :t (.|.) |
| 2026-04-13 18:03:18 +0000 | <gentauro> | I perhaps spend a bit of time on it and make it right. Perhaps it could somehow end in `base`? |
| 2026-04-13 18:02:23 +0000 | <janus> | but you could do the same in haskell with code generation no? |
| 2026-04-13 18:02:09 +0000 | <gentauro> | mauke: yeah, that's what the F# people do with a bit of syntactic sugar |
| 2026-04-13 18:02:04 +0000 | <EvanR> | .oO( what if you made the Enum instance use powers of two instead of sequential Ints ) |
| 2026-04-13 18:01:28 +0000 | gentauro | enums in F# are just sum-types with a numerical value |
| 2026-04-13 18:01:25 +0000 | <mauke> | you can use an integer type (and bitwise or), or a set of enum values, or a record of bools |
| 2026-04-13 18:00:58 +0000 | <EvanR> | you can express that in haskell using pattern synonyms for powers of two |
| 2026-04-13 18:00:48 +0000 | <gentauro> | so by using the OR operator, you can store in a single enum field several values |
| 2026-04-13 18:00:45 +0000 | <EvanR> | oh |
| 2026-04-13 18:00:35 +0000 | <gentauro> | Flags in F# is like powers of 2 |
| 2026-04-13 18:00:24 +0000 | <gentauro> | EvanR: but that's a range right? |
| 2026-04-13 18:00:22 +0000 | <mauke> | gentauro: no |
| 2026-04-13 18:00:16 +0000 | <EvanR> | we have multiple enum values |
| 2026-04-13 17:59:59 +0000 | <EvanR> | facepalm |
| 2026-04-13 17:59:47 +0000 | <lambdabot> | In the expression: enumFromTo False True :: [Int]Couldn't match expected typ... |
| 2026-04-13 17:59:47 +0000 | <lambdabot> | In the second argument of ‘enumFromTo’, namely ‘True’ |
| 2026-04-13 17:59:47 +0000 | <lambdabot> | Couldn't match expected type ‘Int’ with actual type ‘Bool’ |
| 2026-04-13 17:59:46 +0000 | <EvanR> | > enumFromTo False True :: [Int] |
| 2026-04-13 17:59:31 +0000 | <lambdabot> | In the expression: enumFromTo 0 1 :: [Bool] |
| 2026-04-13 17:59:31 +0000 | <lambdabot> | In the first argument of ‘enumFromTo’, namely ‘0’ |
| 2026-04-13 17:59:31 +0000 | <lambdabot> | No instance for ‘Num Bool’ arising from the literal ‘0’ |
| 2026-04-13 17:59:30 +0000 | <EvanR> | > enumFromTo 0 1 :: [Bool] |
| 2026-04-13 17:58:39 +0000 | <gentauro> | do we have multiple enum values in Haskell? F# -> `type [<Flags>] FooBar = Foo = 0 | Bar = 1 | Baz = 2 | Qux = 4`. let barQux = Bar ||| Qux`. Source: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/enumerations#remarks |
| 2026-04-13 17:57:56 +0000 | arandombit | (~arandombi@user/arandombit) arandombit |
| 2026-04-13 17:57:56 +0000 | arandombit | (~arandombi@2a02:2455:8656:7100:21e4:4567:22be:8bd9) (Changing host) |
| 2026-04-13 17:57:56 +0000 | arandombit | (~arandombi@2a02:2455:8656:7100:21e4:4567:22be:8bd9) |
| 2026-04-13 17:57:08 +0000 | dumptruckman | (~dumptruck@45-79-134-140.ip.linodeusercontent.com) (Quit: ZNC - https://znc.in) |