Logs: liberachat/#haskell
| 2021-07-10 10:03:14 | × | peterhil quits (~peterhil@dsl-hkibng32-54f849-252.dhcp.inet.fi) (Ping timeout: 272 seconds) |
| 2021-07-10 10:05:35 | × | azeem quits (~azeem@176.201.17.130) (Ping timeout: 255 seconds) |
| 2021-07-10 10:05:51 | → | azeem joins (~azeem@176.201.17.130) |
| 2021-07-10 10:07:43 | → | beka joins (~beka@104-244-27-23.static.monkeybrains.net) |
| 2021-07-10 10:08:00 | × | Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
| 2021-07-10 10:15:04 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-07-10 10:16:32 | × | cheater quits (~Username@user/cheater) (Ping timeout: 272 seconds) |
| 2021-07-10 10:16:43 | → | cheater joins (~Username@user/cheater) |
| 2021-07-10 10:18:43 | × | Vajb quits (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi) (Read error: Connection reset by peer) |
| 2021-07-10 10:19:42 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 272 seconds) |
| 2021-07-10 10:19:45 | → | Vajb joins (~Vajb@2001:999:62:1d53:26b1:6c9b:c1ed:9c01) |
| 2021-07-10 10:23:08 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-07-10 10:24:22 | × | ukari quits (~ukari@user/ukari) (Remote host closed the connection) |
| 2021-07-10 10:24:50 | → | ukari joins (~ukari@user/ukari) |
| 2021-07-10 10:28:15 | × | beka quits (~beka@104-244-27-23.static.monkeybrains.net) (Ping timeout: 252 seconds) |
| 2021-07-10 10:30:32 | → | hexfive joins (~eric@50.35.83.177) |
| 2021-07-10 10:31:12 | × | hexfive quits (~eric@50.35.83.177) (Client Quit) |
| 2021-07-10 10:32:32 | → | thyriaen joins (~thyriaen@45.178.73.238) |
| 2021-07-10 10:33:45 | <thyriaen> | howdy, friends - i have created a new data myType = Foo Int |
| 2021-07-10 10:33:56 | <thyriaen> | how can i then access the Int ? |
| 2021-07-10 10:35:42 | <Rembane> | thyriaen: f (Foo i) = i |
| 2021-07-10 10:35:50 | × | Maxdamantus quits (~Maxdamant@user/maxdamantus) (Ping timeout: 258 seconds) |
| 2021-07-10 10:36:11 | <thyriaen> | so only possible with pattern matching ? |
| 2021-07-10 10:39:06 | <Rembane> | thyriaen: Yeah, there's another variant that looks like this: data MyType = Foo { unFoo :: Int } |
| 2021-07-10 10:39:18 | <Rembane> | thyriaen: Called like this: unFoo (Foo 7) |
| 2021-07-10 10:39:32 | <thyriaen> | okay, thanks |
| 2021-07-10 10:39:53 | <Rembane> | np! |
| 2021-07-10 10:40:50 | → | notzmv joins (~zmv@user/notzmv) |
| 2021-07-10 10:40:51 | <thyriaen> | Rembane, maybe if i can ask another data Type question |
| 2021-07-10 10:43:08 | <Rembane> | thyriaen: Go ahead! |
| 2021-07-10 10:43:09 | <thyriaen> | what is the difference between // data Foo = Foo Int // and // data Foo = Int // why is there a data constructor ? |
| 2021-07-10 10:43:23 | <thyriaen> | what is the point of the 2nd Foo |
| 2021-07-10 10:44:30 | <Rembane> | thyriaen: If you want to give an alias to a data type you can do it like this: type Foo = Int, but then you got almost nothing from it except for a fancy name. |
| 2021-07-10 10:44:50 | <Rembane> | thyriaen: By adding another constructor you wrap the other data type in your data type and you decide what properties that data type should have. |
| 2021-07-10 10:45:32 | <thyriaen> | i dont mean type |
| 2021-07-10 10:45:35 | <thyriaen> | maybe i made the example too little |
| 2021-07-10 10:45:39 | <Rembane> | thyriaen: You can also give it different constructors like for instance: data ShoeSize = EU Int | US Int | FootLengthCM Float | FootLengthImperial Float |
| 2021-07-10 10:45:47 | <Rembane> | thyriaen: Add more example! :) |
| 2021-07-10 10:45:49 | × | qbt quits (~edun@user/edun) (Ping timeout: 246 seconds) |
| 2021-07-10 10:46:19 | <thyriaen> | yes, like with the ShoeSize there is no additional ShoeSize data constructor |
| 2021-07-10 10:46:32 | <thyriaen> | you did not wrote data ShoeSize = ShoeSize EU Int | ... |
| 2021-07-10 10:46:57 | <boxscape> | thyriaen: the fact that both are called Foo is a coincidence, you could have just as well called it `data Foo = Bar Int`, that would just mean you have to use the `Bar` constructor to construct values of type `Foo` |
| 2021-07-10 10:47:22 | <Rembane> | thyriaen: In that case the constructor is EU |
| 2021-07-10 10:47:31 | <Rembane> | thyriaen: The type name is ShoeSize |
| 2021-07-10 10:48:13 | <Rembane> | thyriaen: Naming the constructor and the type the same thing is IIRC called type punting and it's very confusing until you get used to it. |
| 2021-07-10 10:48:19 | <boxscape> | (punning) |
| 2021-07-10 10:48:28 | <thyriaen> | well |
| 2021-07-10 10:48:33 | <thyriaen> | call me confused :) |
| 2021-07-10 10:48:36 | <Rembane> | ^^ |
| 2021-07-10 10:49:47 | <Rembane> | boxscape: I didn't recall correctly. Thank you! :) |
| 2021-07-10 10:50:03 | <ahdyt> | the second Foo is the constructor |
| 2021-07-10 10:50:26 | <ahdyt> | you can make smart constructor by e.g data Foo = Foo Int, mkFoo = Foo, then you can call mkFoo 2 |
| 2021-07-10 10:50:43 | <Rembane> | thyriaen: This might make it more clear: data SomeType = SomeConstructor |
| 2021-07-10 10:50:58 | <ahdyt> | you can name your constructor as you want like EU, Bar, Baz, Whatever |
| 2021-07-10 10:51:28 | <ahdyt> | ah yeah that's sum up Rembane. |
| 2021-07-10 10:53:54 | × | awth13 quits (~user@user/awth13) (Ping timeout: 272 seconds) |
| 2021-07-10 10:54:02 | → | eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:39f3:da:7ab8:bc1e) |
| 2021-07-10 10:54:31 | → | awth13 joins (~user@user/awth13) |
| 2021-07-10 10:57:47 | × | azeem quits (~azeem@176.201.17.130) (Read error: Connection reset by peer) |
| 2021-07-10 10:58:41 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:39f3:da:7ab8:bc1e) (Ping timeout: 255 seconds) |
| 2021-07-10 10:59:03 | → | azeem joins (~azeem@dynamic-adsl-84-220-226-129.clienti.tiscali.it) |
| 2021-07-10 11:00:19 | → | chomwitt joins (~Pitsikoko@2a02:587:dc04:e00:d8f7:cdfe:4658:bec4) |
| 2021-07-10 11:01:36 | → | Maxdamantus joins (~Maxdamant@user/maxdamantus) |
| 2021-07-10 11:04:40 | × | azeem quits (~azeem@dynamic-adsl-84-220-226-129.clienti.tiscali.it) (Read error: Connection reset by peer) |
| 2021-07-10 11:06:57 | → | AlexNoo_ joins (~AlexNoo@94.233.240.7) |
| 2021-07-10 11:09:15 | × | lambdap quits (~lambdap@static.167.190.119.168.clients.your-server.de) (Read error: Connection reset by peer) |
| 2021-07-10 11:09:44 | × | AlexZenon quits (~alzenon@178.34.162.146) (Ping timeout: 272 seconds) |
| 2021-07-10 11:09:46 | × | Alex_test quits (~al_test@178.34.162.146) (Ping timeout: 240 seconds) |
| 2021-07-10 11:09:47 | → | lambdap joins (~lambdap@static.167.190.119.168.clients.your-server.de) |
| 2021-07-10 11:10:34 | × | AlexNoo quits (~AlexNoo@178.34.162.146) (Ping timeout: 252 seconds) |
| 2021-07-10 11:11:18 | × | Vajb quits (~Vajb@2001:999:62:1d53:26b1:6c9b:c1ed:9c01) (Read error: Connection reset by peer) |
| 2021-07-10 11:12:31 | → | azeem joins (~azeem@dynamic-adsl-84-220-226-129.clienti.tiscali.it) |
| 2021-07-10 11:13:04 | → | AlexZenon joins (~alzenon@94.233.240.7) |
| 2021-07-10 11:13:14 | → | Vajb joins (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi) |
| 2021-07-10 11:13:45 | → | Alex_test joins (~al_test@94.233.240.7) |
| 2021-07-10 11:14:38 | <ahdyt> | \ |
| 2021-07-10 11:17:12 | × | chomwitt quits (~Pitsikoko@2a02:587:dc04:e00:d8f7:cdfe:4658:bec4) (Ping timeout: 252 seconds) |
| 2021-07-10 11:17:38 | × | juhp quits (~juhp@128.106.188.66) (Quit: juhp) |
| 2021-07-10 11:17:51 | → | juhp joins (~juhp@128.106.188.66) |
| 2021-07-10 11:25:53 | → | peterhil joins (~peterhil@dsl-hkibng32-54f849-252.dhcp.inet.fi) |
| 2021-07-10 11:27:39 | × | acidjnk quits (~acidjnk@p200300d0c72b9550ece5a41d65e4abaa.dip0.t-ipconnect.de) (Ping timeout: 252 seconds) |
| 2021-07-10 11:29:03 | → | favonia joins (~favonia@user/favonia) |
| 2021-07-10 11:33:22 | × | Vajb quits (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi) (Read error: Connection reset by peer) |
| 2021-07-10 11:34:28 | → | Vajb joins (~Vajb@2001:999:62:1d53:26b1:6c9b:c1ed:9c01) |
| 2021-07-10 11:36:14 | × | thyriaen quits (~thyriaen@45.178.73.238) (Quit: Leaving) |
| 2021-07-10 11:41:00 | × | Vajb quits (~Vajb@2001:999:62:1d53:26b1:6c9b:c1ed:9c01) (Read error: Connection reset by peer) |
| 2021-07-10 11:41:06 | → | Vajb joins (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi) |
| 2021-07-10 11:43:41 | × | wallymathieu quits (~wallymath@94.191.154.61) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-07-10 11:44:21 | → | wallymathieu joins (~wallymath@94.191.154.61.mobile.tre.se) |
| 2021-07-10 11:44:22 | × | wallymathieu quits (~wallymath@94.191.154.61.mobile.tre.se) (Client Quit) |
| 2021-07-10 11:44:40 | × | oxide quits (~lambda@user/oxide) (Read error: Connection reset by peer) |
| 2021-07-10 11:44:44 | → | wallymathieu joins (~wallymath@94.191.154.61) |
| 2021-07-10 11:44:44 | × | wallymathieu quits (~wallymath@94.191.154.61) (Client Quit) |
| 2021-07-10 11:45:04 | → | wallymathieu joins (~wallymath@94.191.154.61) |
| 2021-07-10 11:45:05 | × | wallymathieu quits (~wallymath@94.191.154.61) (Client Quit) |
| 2021-07-10 11:49:02 | × | chris-the-slurpa quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2021-07-10 11:49:08 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-07-10 11:49:22 | × | xff0x quits (~xff0x@2001:1a81:525a:ea00:a07c:46ec:2ccb:d36d) (Ping timeout: 240 seconds) |
| 2021-07-10 11:50:30 | → | xff0x joins (~xff0x@2001:1a81:525a:ea00:2bea:6319:b748:f3db) |
| 2021-07-10 11:58:26 | × | fendor quits (~fendor@91.141.50.81.wireless.dyn.drei.com) (Read error: Connection reset by peer) |
All times are in UTC.