Logs: freenode/#haskell
| 2021-04-29 07:55:36 | → | nut joins (~gtk@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) |
| 2021-04-29 07:56:39 | <nut> | is it possible to pattern match on data type? myfunc:: (MyClass a) => [a] -> ... I want to do different things on different a |
| 2021-04-29 07:57:15 | <opqdonut> | you need type classes for that |
| 2021-04-29 07:57:51 | × | hyiltiz quits (~quassel@unaffiliated/hyiltiz) (Ping timeout: 252 seconds) |
| 2021-04-29 07:58:11 | <opqdonut> | so something like `class MyFunc a where myfunc :: MyClass a => [a] -> Result; instance MyFunc Int where myfunc :: [Int] -> Result; instance MyFunc String where myfunc :: [String] -> Result` |
| 2021-04-29 07:58:26 | → | hyiltiz joins (~quassel@31.220.5.250) |
| 2021-04-29 07:58:28 | × | hyiltiz quits (~quassel@31.220.5.250) (Changing host) |
| 2021-04-29 07:58:29 | → | hyiltiz joins (~quassel@unaffiliated/hyiltiz) |
| 2021-04-29 07:58:50 | <nut> | i see |
| 2021-04-29 07:59:32 | × | geowiesnot quits (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr) (Ping timeout: 246 seconds) |
| 2021-04-29 07:59:34 | <nut> | My use case is to wrap the gnu gsl lib in Haskell and need to create gsl_vector to hold different haskell types. |
| 2021-04-29 07:59:49 | <nut> | even with the type class method, there'll be lots of repetitive code |
| 2021-04-29 08:00:04 | → | enoq joins (~textual@194-208-146-143.lampert.tv) |
| 2021-04-29 08:01:44 | × | nineonine quits (~nineonine@2604:3d08:7785:9600:b972:f5c7:dd8f:5421) (Ping timeout: 250 seconds) |
| 2021-04-29 08:01:49 | m1dnight_ | is now known as ssdflkjshflkjhsf |
| 2021-04-29 08:01:52 | ssdflkjshflkjhsf | is now known as m1dnight_ |
| 2021-04-29 08:03:04 | → | is_null joins (~jpic@pdpc/supporter/professional/is-null) |
| 2021-04-29 08:03:30 | m1dnight_ | is now known as ssdflkjshflkjhsf |
| 2021-04-29 08:03:30 | ssdflkjshflkjhsf | is now known as m1dnight_ |
| 2021-04-29 08:03:33 | → | elfets joins (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) |
| 2021-04-29 08:05:00 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Quit: leaving) |
| 2021-04-29 08:05:29 | → | takuan joins (~takuan@178-116-218-225.access.telenet.be) |
| 2021-04-29 08:05:33 | × | cole-h quits (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net) (Ping timeout: 240 seconds) |
| 2021-04-29 08:06:08 | m1dnight_ | is now known as m1dnight__ |
| 2021-04-29 08:08:17 | → | hendursa1 joins (~weechat@gateway/tor-sasl/hendursaga) |
| 2021-04-29 08:09:07 | <hololeap> | nut: typeclasses essentially match on a data type |
| 2021-04-29 08:09:52 | × | frozenErebus quits (~frozenEre@37.231.244.249) (Ping timeout: 268 seconds) |
| 2021-04-29 08:11:09 | × | hendursaga quits (~weechat@gateway/tor-sasl/hendursaga) (Ping timeout: 240 seconds) |
| 2021-04-29 08:11:29 | → | werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
| 2021-04-29 08:12:34 | × | gitgood quits (~gitgood@80-44-9-246.dynamic.dsl.as9105.com) (Quit: Probably away to do something really awesome) |
| 2021-04-29 08:12:35 | → | heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-04-29 08:13:35 | → | kritzefitz joins (~kritzefit@p200300ecdf3c5b009ca7d9f9eb7bbe17.dip0.t-ipconnect.de) |
| 2021-04-29 08:14:15 | → | heatsink_ joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-04-29 08:14:23 | × | natechan quits (~natechan@108-233-125-227.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 252 seconds) |
| 2021-04-29 08:14:25 | <hololeap> | also note that what opqdonut suggested requires FlexibleInstances |
| 2021-04-29 08:15:19 | → | gehmehgeh joins (~ircuser1@gateway/tor-sasl/gehmehgeh) |
| 2021-04-29 08:15:33 | → | jgt joins (~jgt@46.154.91.194) |
| 2021-04-29 08:15:50 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-04-29 08:16:58 | × | maroloccio quits (~marolocci@pousada3ja.mma.com.br) (Quit: WeeChat 2.3) |
| 2021-04-29 08:17:07 | × | jgt_ quits (~jgt@88.225.221.135) (Ping timeout: 252 seconds) |
| 2021-04-29 08:17:16 | × | heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds) |
| 2021-04-29 08:18:27 | × | heatsink_ quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 246 seconds) |
| 2021-04-29 08:20:21 | × | ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 268 seconds) |
| 2021-04-29 08:21:19 | m1dnight__ | is now known as m1dnight_ |
| 2021-04-29 08:21:27 | → | natechan joins (~natechan@108-233-125-227.lightspeed.sntcca.sbcglobal.net) |
| 2021-04-29 08:22:23 | → | Qwerky joins (~qwerky@37.171.11.15) |
| 2021-04-29 08:23:04 | ← | jakalx parts (~jakalx@base.jakalx.net) () |
| 2021-04-29 08:24:39 | → | frozenErebus joins (~frozenEre@37.231.244.249) |
| 2021-04-29 08:25:16 | × | bennofs_ quits (~quassel@x4dbf4f4d.dyn.telefonica.de) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
| 2021-04-29 08:25:26 | → | acidjnk_new2 joins (~acidjnk@p200300d0c72b9548b4aacef2f046ba0b.dip0.t-ipconnect.de) |
| 2021-04-29 08:25:33 | m1dnight_ | is now known as m1dnight__ |
| 2021-04-29 08:26:33 | → | lowdude[m] joins (lowdudemat@gateway/shell/matrix.org/x-tuvkranqrmxuckyh) |
| 2021-04-29 08:27:04 | → | vchlup_ joins (~vchlup@nat.brnet.cz) |
| 2021-04-29 08:27:06 | × | vchlup quits (~vchlup@nat.brnet.cz) (Ping timeout: 240 seconds) |
| 2021-04-29 08:29:27 | × | xff0x quits (~xff0x@2001:1a81:524d:ea00:c15c:a6f:641:7fe3) (Ping timeout: 250 seconds) |
| 2021-04-29 08:29:28 | → | ddellacosta joins (~ddellacos@ool-44c73afa.dyn.optonline.net) |
| 2021-04-29 08:30:12 | → | xff0x joins (~xff0x@2001:1a81:524d:ea00:13a7:1ddd:e94:27b2) |
| 2021-04-29 08:31:16 | → | nineonine joins (~nineonine@2604:3d08:7785:9600:b972:f5c7:dd8f:5421) |
| 2021-04-29 08:34:59 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-04-29 08:35:06 | × | ddellacosta quits (~ddellacos@ool-44c73afa.dyn.optonline.net) (Ping timeout: 240 seconds) |
| 2021-04-29 08:35:31 | × | nineonine quits (~nineonine@2604:3d08:7785:9600:b972:f5c7:dd8f:5421) (Ping timeout: 250 seconds) |
| 2021-04-29 08:35:35 | → | enobayram joins (4eaf3ebd@78.175.62.189) |
| 2021-04-29 08:40:05 | <olligobber> | so it turns out IO doesn't satisfy the laws for Alternative, in that I have f and x such that `f (x <|> empty) == pure True' and `f (empty <|> x) == pure False' |
| 2021-04-29 08:45:43 | → | malumore joins (~malumore@151.62.116.76) |
| 2021-04-29 08:47:10 | <olligobber> | IO was a mistake |
| 2021-04-29 08:48:24 | <hololeap> | % (pure True <|> empty) :: IO Bool |
| 2021-04-29 08:48:24 | <yahb> | hololeap: True |
| 2021-04-29 08:48:30 | → | ania123 joins (5e89ad7c@94.137.173.124) |
| 2021-04-29 08:48:36 | <hololeap> | % (empty <|> pure True) :: IO Bool |
| 2021-04-29 08:48:36 | <yahb> | hololeap: True |
| 2021-04-29 08:48:45 | → | jpe90 joins (~user@pool-108-31-85-19.washdc.fios.verizon.net) |
| 2021-04-29 08:48:53 | ← | jakalx parts (~jakalx@base.jakalx.net) ("Error from remote client") |
| 2021-04-29 08:49:15 | → | jgt_ joins (~jgt@46.154.77.142) |
| 2021-04-29 08:49:40 | × | jgt quits (~jgt@46.154.91.194) (Remote host closed the connection) |
| 2021-04-29 08:49:45 | <enobayram> | What is the f and the x that you have? |
| 2021-04-29 08:50:00 | <olligobber> | x is `fail "Error"' |
| 2021-04-29 08:50:26 | <olligobber> | f is `((==) <$> try empty) <*>)' |
| 2021-04-29 08:50:41 | <olligobber> | % (==) <$> (try empty :: IO (Either IOError String)) <*> try (fail "Error" <|> empty) |
| 2021-04-29 08:50:41 | <yahb> | olligobber: True |
| 2021-04-29 08:50:53 | <olligobber> | % (==) <$> (try empty :: IO (Either IOError String)) <*> try (empty <|> fail "Error") |
| 2021-04-29 08:50:53 | <yahb> | olligobber: False |
| 2021-04-29 08:51:01 | <olligobber> | oh, and the try as well |
| 2021-04-29 08:51:17 | <olligobber> | f is `((==) <$> try empty) <*>) . try' |
| 2021-04-29 08:52:03 | <enobayram> | I see, seems to me like the Alternative instance is at fault here |
| 2021-04-29 08:52:54 | <olligobber> | yeah, it always goes with the second option if the first is an error |
| 2021-04-29 08:53:55 | <olligobber> | well, not "is an error" but "produces an error" |
| 2021-04-29 08:53:56 | → | geowiesnot joins (~user@87-89-181-157.abo.bbox.fr) |
| 2021-04-29 08:54:07 | <hololeap> | % (fail "Error" <|> empty) :: IO a |
| 2021-04-29 08:54:07 | <yahb> | hololeap: *** Exception: user error (mzero) |
| 2021-04-29 08:54:14 | <enobayram> | If empty is supposed to be the identity element of <|>, it should be throwing an exception that <|> recognizes |
| 2021-04-29 08:54:20 | <olligobber> | yeah |
| 2021-04-29 08:54:22 | <hololeap> | % (empty <|> fail "Error") :: IO a |
| 2021-04-29 08:54:22 | <yahb> | hololeap: *** Exception: user error (Error) |
| 2021-04-29 08:54:52 | <olligobber> | % (==) <$> try (fail "mzero") <*> try empty |
| 2021-04-29 08:54:52 | <yahb> | olligobber: ; <interactive>:152:1: error:; * Ambiguous type variable `e0' arising from a use of `=='; prevents the constraint `(Eq e0)' from being solved.; Probable fix: use a type annotation to specify what `e0' should be.; These potential instances exist:; instance Eq a => Eq (ZipList a) -- Defined in `Control.Applicative'; instance Eq (Chan a) -- Defined in `Control.Concurren |
| 2021-04-29 08:55:06 | <olligobber> | % (==) <$> try (fail "mzero") <*> try (empty :: IO ()) |
| 2021-04-29 08:55:06 | <yahb> | olligobber: ; <interactive>:153:1: error:; * Ambiguous type variable `e0' arising from a use of `=='; prevents the constraint `(Eq e0)' from being solved.; Probable fix: use a type annotation to specify what `e0' should be.; These potential instances exist:; instance Eq a => Eq (ZipList a) -- Defined in `Control.Applicative'; instance Eq (Chan a) -- Defined in `Control.Concurren |
| 2021-04-29 08:55:16 | → | ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta) |
| 2021-04-29 08:55:16 | <olligobber> | % (==) <$> try (fail "mzero") <*> (try empty :: IO IOError ()) |
| 2021-04-29 08:55:16 | <yahb> | olligobber: ; <interactive>:154:47: error:; * Expected kind `* -> *', but `IO IOError' has kind `*'; * In an expression type signature: IO IOError (); In the second argument of `(<*>)', namely `(try empty :: IO IOError ())'; In the expression: (==) <$> try (fail "mzero") <*> (try empty :: IO IOError ()) |
All times are in UTC.