Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 889 890 891 892 893 894 895 896 897 898 899 .. 18027
1,802,623 events total
2021-07-10 08:16:33 <ahdyt> 35 { name :: Name,
2021-07-10 08:16:33 <ahdyt> 36 price :: Price,
2021-07-10 08:16:34 <ahdyt> 37 pouch :: Pouch,
2021-07-10 08:16:34 <ahdyt> 38 weight :: Weight
2021-07-10 08:16:35 <ahdyt> 39 }
2021-07-10 08:16:35 <ahdyt> 40 deriving (Eq)
2021-07-10 08:16:36 <ahdyt> ```
2021-07-10 08:17:06 <ahdyt> using DeriveGeneric make that rawFunction included in the json file.
2021-07-10 08:17:22 <ahdyt> and making instance for every of that is insane...
2021-07-10 08:17:27 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 258 seconds)
2021-07-10 08:17:29 × shredder quits (~user@user/shredder) (Quit: quitting)
2021-07-10 08:17:30 × geekosaur quits (~geekosaur@xmonad/geekosaur) (Remote host closed the connection)
2021-07-10 08:17:55 geekosaur joins (~geekosaur@xmonad/geekosaur)
2021-07-10 08:18:19 shredder joins (~user@user/shredder)
2021-07-10 08:20:10 × beka quits (~beka@104-244-27-23.static.monkeybrains.net) (Ping timeout: 240 seconds)
2021-07-10 08:20:44 × yauhsien quits (~yauhsien@118-167-64-241.dynamic-ip.hinet.net) (Ping timeout: 255 seconds)
2021-07-10 08:23:16 Lord_of_Life_ joins (~Lord@user/lord-of-life/x-2819915)
2021-07-10 08:24:47 × Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 255 seconds)
2021-07-10 08:25:54 Lord_of_Life_ is now known as Lord_of_Life
2021-07-10 08:27:19 × Pickchea quits (~private@user/pickchea) (Quit: Leaving)
2021-07-10 08:27:54 Guest58 joins (~Guest58@50.47.115.102)
2021-07-10 08:28:04 × Guest58 quits (~Guest58@50.47.115.102) (Client Quit)
2021-07-10 08:28:51 mikoto-chan joins (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be)
2021-07-10 08:30:11 × nick8325 quits (~nick8325@2001:9b1:26f9:3e00:b7ea:ac95:e18:4c1d) (Quit: Leaving.)
2021-07-10 08:30:44 <arahael> ahdyt: Next time, suggest you use a paste site. (There's one suggested in the /topic). Even if people are polite, the IRC servers will usually *severely* rate limit you if you flood like that for a while.
2021-07-10 08:35:56 fendor joins (~fendor@91.141.50.81.wireless.dyn.drei.com)
2021-07-10 08:37:14 × ahdyt quits (~ahdyt@114.125.111.246) (Quit: Ping timeout (120 seconds))
2021-07-10 08:38:19 ahdyt joins (~ahdyt@114.125.111.246)
2021-07-10 08:38:58 <ahdyt> https://paste.tomsmeding.com/XwWbfULZ
2021-07-10 08:39:00 <ahdyt> arahael
2021-07-10 08:39:05 wallymathieu joins (~wallymath@81-234-151-21-no94.tbcn.telia.com)
2021-07-10 08:39:50 × notzmv quits (~zmv@user/notzmv) (Read error: Connection reset by peer)
2021-07-10 08:40:32 <ahdyt> How to prevent the rawName rawPrice rawPouch rawWeight shows in json file? those raw* function inside newtype
2021-07-10 08:43:57 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-07-10 08:44:35 hughjfchen joins (~hughjfche@vmi556545.contaboserver.net)
2021-07-10 08:45:53 × hughjfchen quits (~hughjfche@vmi556545.contaboserver.net) (Client Quit)
2021-07-10 08:46:17 × fendor quits (~fendor@91.141.50.81.wireless.dyn.drei.com) (Remote host closed the connection)
2021-07-10 08:48:14 fendor joins (~fendor@91.141.50.81.wireless.dyn.drei.com)
2021-07-10 08:49:30 × shredder quits (~user@user/shredder) (Quit: quitting)
2021-07-10 08:50:50 shredder joins (~user@user/shredder)
2021-07-10 08:52:25 <arahael> ahdyt: You'd need to either change that name, or implement custom class instances instead of letting haskell do it for you.
2021-07-10 08:52:51 <arahael> ahdyt: In the same way you've also done custom instances for Show.
2021-07-10 08:54:28 <ahdyt> but it's must be an object or array, that's aeson limitation. how to just instance of a String, Int, or PrimitiveType
2021-07-10 08:54:56 <ahdyt> Note that the JSON standard only allows arrays or objects of things at the top-level. Since this library follows the standard, calling decode on an unsupported result type will typecheck, but will always "fail":
2021-07-10 08:56:33 <arahael> Well, that's a somewhat different question - for the first question, take a look at https://github.com/haskell/aeson/blob/c1b97f6f6303680453ed54ddb6c8d91466261f3a/examples/src/Simplest.hs#L19
2021-07-10 08:57:03 <arahael> For the second, wrap the root item in an object or array if that restriction is a problem?
2021-07-10 08:58:43 <ahdyt> well, the problem is to get rid of the rawFunction from newtype. and that instance FromJson,ToJson Coord
2021-07-10 08:58:44 <ahdyt> is same as the one I made which is commented, as it's doens't change anything, the problem is in the newtype.
2021-07-10 09:00:35 <arahael> ahdyt: Because the one you commented is leveraging the auto-generated instances. You'd need dto write custom instances for ALL of them.
2021-07-10 09:02:01 amahl joins (~amahl@dsl-jklbng12-54fbca-64.dhcp.inet.fi)
2021-07-10 09:03:47 <ahdyt> yeah true, and that's my question.
2021-07-10 09:06:51 × hnOsmium0001 quits (uid453710@id-453710.stonehaven.irccloud.com) (Quit: Connection closed for inactivity)
2021-07-10 09:06:58 × wallymathieu quits (~wallymath@81-234-151-21-no94.tbcn.telia.com) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-07-10 09:12:10 <arahael> ahdyt: And do you have the answer now?
2021-07-10 09:12:23 lbseale joins (~lbseale@user/ep1ctetus)
2021-07-10 09:13:29 _ht joins (~quassel@82-169-194-8.biz.kpn.net)
2021-07-10 09:15:34 shriekingnoise joins (~shrieking@186.137.144.80)
2021-07-10 09:16:38 shriekingnoise parts (~shrieking@186.137.144.80) ()
2021-07-10 09:16:57 × econo quits (uid147250@user/econo) (Quit: Connection closed for inactivity)
2021-07-10 09:18:34 × shredder quits (~user@user/shredder) (Quit: quitting)
2021-07-10 09:19:01 yauhsien joins (~yauhsien@118-167-64-241.dynamic-ip.hinet.net)
2021-07-10 09:19:31 <ahdyt> nope, not yet
2021-07-10 09:20:24 shredder joins (~user@user/shredder)
2021-07-10 09:21:13 <ahdyt> https://paste.tomsmeding.com/7Jh45fru
2021-07-10 09:27:25 gehmehgeh joins (~user@user/gehmehgeh)
2021-07-10 09:28:19 <arahael> ahdyt: Because it has to be Object, not String.
2021-07-10 09:30:06 <arahael> Ooh, sorry, has to be an instance of Value, but people often match Object.
2021-07-10 09:30:52 <arahael> (And your 'v' in "String v" is not itself a Name)
2021-07-10 09:31:13 <ahdyt> it's intended
2021-07-10 09:31:19 <arahael> You probably want: parseJSON (String v) = Name v
2021-07-10 09:31:39 <ahdyt> I think that's not work too?
2021-07-10 09:31:43 <arahael> (Or Name{rawValue=v} if you're using record syntax)
2021-07-10 09:31:45 <ahdyt> should I make Name instance of Value ?
2021-07-10 09:32:07 <ahdyt> the error still same
2021-07-10 09:32:12 <ahdyt> Couldn't match expected type ‘aeson-1.5.6.0:Data.Aeson.Types.Internal.Parser Name’ with actual type ‘Name’
2021-07-10 09:32:48 <ahdyt> eventhough I add Name before v
2021-07-10 09:32:57 wallymathieu joins (~wallymath@94.191.154.61)
2021-07-10 09:33:37 <wz1000> arahael: you can use `deriving newtype (FromJSON, ToJSON)` and things should work
2021-07-10 09:34:03 <wz1000> with `{-# LANGUAGE GeneralisedNewtypeDeriving, DerivingStrategies #-}
2021-07-10 09:34:09 <ahdyt> wait really?
2021-07-10 09:34:11 <wz1000> I mean ahdyt
2021-07-10 09:34:13 <wz1000> yes
2021-07-10 09:35:57 <ahdyt> oh yeah? how can it be? can u ref me to the doc? wz1000
2021-07-10 09:36:09 <arahael> wz1000: ahdyt also wants to not have the record fields to be in the resulting json though. I've already said they need to be changed, or to have a custom instance.
2021-07-10 09:36:09 Lycurgus joins (~juan@cpe-45-46-140-49.buffalo.res.rr.com)
2021-07-10 09:36:19 <ahdyt> no it's fixed
2021-07-10 09:36:25 <ahdyt> adding newtype after deriving
2021-07-10 09:37:38 <wz1000> sorry, have to go now. you can look at the docs for GeneralisedNewtypeDeriving in the GHC users guide
2021-07-10 09:38:08 <ahdyt> okay2, thank you.
2021-07-10 09:41:19 <arahael> Fancy.
2021-07-10 09:42:36 × azeem quits (~azeem@dynamic-adsl-84-220-226-129.clienti.tiscali.it) (Ping timeout: 252 seconds)
2021-07-10 09:43:04 azeem joins (~azeem@176.201.17.130)
2021-07-10 09:43:12 lavaman joins (~lavaman@98.38.249.169)
2021-07-10 09:43:43 × lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection)
2021-07-10 09:52:42 eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:39f3:da:7ab8:bc1e)
2021-07-10 09:53:00 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds)
2021-07-10 09:53:49 × chexum quits (~chexum@gateway/tor-sasl/chexum) (Quit: -)
2021-07-10 09:55:37 chexum joins (~chexum@gateway/tor-sasl/chexum)
2021-07-10 09:57:02 × eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:39f3:da:7ab8:bc1e) (Ping timeout: 255 seconds)
2021-07-10 09:59:08 × Lycurgus quits (~juan@cpe-45-46-140-49.buffalo.res.rr.com) (Quit: Exeunt)

All times are in UTC.