Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 892 893 894 895 896 897 898 899 900 901 902 .. 5022
502,152 events total
2020-10-27 13:36:38 mimi_vx joins (~mimi@tulipan.habr.nat.praha12.net)
2020-10-27 13:36:42 <Raito_Bezarius> charLiteral = satisfy (all isValidCharacter) <|> string "\̈ <|> string "̈" <?> "a character"
2020-10-27 13:36:45 <Raito_Bezarius> something like this
2020-10-27 13:36:58 <Raito_Bezarius> it would produce [Char] necessarily, right?
2020-10-27 13:37:22 <Raito_Bezarius> is it a bad idea to have a charLiteral producing [Char]? Is it easy to build stringLiteral which (++) the many charLiteral (?)
2020-10-27 13:38:34 <Raito_Bezarius> (also, it seems like that this charLiteral produces a type of (Foldable t) => m (t Char) rather than m [Char] which I can understand but I'm not sure how I can enforce the array version
2020-10-27 13:39:11 vacm joins (~vacwm@70.23.92.191)
2020-10-27 13:39:20 <geekosaur> list, not array; and you just ive that as the type signature instead of the more general inferred one
2020-10-27 13:39:34 <geekosaur> inference always goes for the most general signature, which is not always what you want
2020-10-27 13:39:46 <geekosaur> *give that
2020-10-27 13:40:08 <Raito_Bezarius> right
2020-10-27 13:40:17 <Raito_Bezarius> what I might not understand
2020-10-27 13:40:28 <Raito_Bezarius> rather than having token of Char, I have now token of [Char]
2020-10-27 13:40:34 <Raito_Bezarius> so parseTest cannot use such a parser looks like
2020-10-27 13:40:48 <Raito_Bezarius> is there a way to keep Char token?
2020-10-27 13:41:01 <Raito_Bezarius> charLiteral
2020-10-27 13:41:04 <Raito_Bezarius> :: (MonadParsec e s m, Tokens s ~ [Char], Token s ~ [Char]) =>
2020-10-27 13:41:06 <Raito_Bezarius> m [Char]
2020-10-27 13:41:08 <Raito_Bezarius> here's the obtained type sig
2020-10-27 13:41:45 <Raito_Bezarius> what I want is Token s ~ Char
2020-10-27 13:42:15 perry69420 joins (6ee39f85@110.227.159.133)
2020-10-27 13:42:59 <geekosaur> not if it returns more than one
2020-10-27 13:43:13 <dminuoso> satisfy :: MonadParsec e s m => (Token s -> Bool) -> m (Token s)
2020-10-27 13:43:14 <geekosaur> what makes you think parseTest can't work with [Char]?
2020-10-27 13:43:44 <Raito_Bezarius> geekosaur: sorry, I meant rather that I would not be able to do parseTest myParser "a string" and would have to do parseTest myParser aListOfString
2020-10-27 13:43:53 <Raito_Bezarius> so if I do, charLiteral = many (satisfy isValidCharacter) <|> string "\̈ <|> string "̈" <?> "a character"
2020-10-27 13:44:19 × dmiles quits (dmiles@c-73-67-179-188.hsd1.wa.comcast.net) (Ping timeout: 256 seconds)
2020-10-27 13:44:45 × drbean quits (~drbean@TC210-63-209-53.static.apol.com.tw) (Ping timeout: 240 seconds)
2020-10-27 13:45:04 × geekosaur quits (82659a09@host154-009.vpn.uakron.edu) (Remote host closed the connection)
2020-10-27 13:45:07 <Raito_Bezarius> but if I do, parseTest (charLiteral :: Parser [Char]) "abc"
2020-10-27 13:45:18 <Raito_Bezarius> it fails with Couldn't match type ‘Text’ with ‘[Char]’
2020-10-27 13:45:21 <Raito_Bezarius> arising from a use of ‘charLiteral’
2020-10-27 13:46:19 <Raito_Bezarius> hm
2020-10-27 13:46:33 <Raito_Bezarius> many will give: m [a]
2020-10-27 13:46:52 <Raito_Bezarius> so many (satisfy X) should give m [Token s] right?
2020-10-27 13:47:09 <Raito_Bezarius> at the same time, string will give m (Tokens s) rather than m [Token s], I suppose?
2020-10-27 13:47:43 <Raito_Bezarius> but as, Tokens s ~ [Char] and Token s ~ Char, shouldn't it work fine?
2020-10-27 13:49:49 × ptrcmd quits (~ptrcmd@unaffiliated/petercommand) (Quit: leaving)
2020-10-27 13:49:57 × roconnor quits (~roconnor@host-23-91-186-59.dyn.295.ca) (Ping timeout: 260 seconds)
2020-10-27 13:50:22 × invaser quits (~Thunderbi@31.148.23.125) (Ping timeout: 246 seconds)
2020-10-27 13:50:56 dmiles joins (dmiles@c-73-67-179-188.hsd1.wa.comcast.net)
2020-10-27 13:52:50 ptrcmd joins (~ptrcmd@unaffiliated/petercommand)
2020-10-27 13:53:01 invaser joins (~Thunderbi@31.148.23.125)
2020-10-27 13:53:06 <gothnbass> I've been looking into porting an existing Common Lisp codebase into Haskell, but it's possible I'm barking up the wrong AST. The application dynamically serialises/deserialises objects according to definitions that are stored in a database, and that cannot be known at compile-time. Is this feasible in Haskell, or am I running myself face-first into the type system?
2020-10-27 13:53:46 ransom joins (~c4264035@2601:285:201:6720:b121:bf7e:316a:1ddf)
2020-10-27 13:55:44 son0p joins (~son0p@181.136.122.143)
2020-10-27 13:55:46 alp joins (~alp@2a01:e0a:58b:4920:aca7:fd95:ef08:3e24)
2020-10-27 13:56:41 kish` is now known as kish
2020-10-27 13:56:58 samlamamma joins (~user@c-8283e355.05-76-616c6b1.bbcust.telenor.se)
2020-10-27 13:56:59 × justanotheruser quits (~justanoth@unaffiliated/justanotheruser) (Ping timeout: 265 seconds)
2020-10-27 13:57:57 Amras joins (~Amras@unaffiliated/amras0000)
2020-10-27 13:58:21 justanotheruser joins (~justanoth@unaffiliated/justanotheruser)
2020-10-27 13:58:40 <dminuoso> gothnbass: That's absolutely feasible.
2020-10-27 13:58:50 × knupfer quits (~Thunderbi@mue-88-130-61-249.dsl.tropolys.de) (Quit: knupfer)
2020-10-27 13:59:33 <gothnbass> That's a relief. There's a lot to love about CL, but I got a taste of the type-system's assurances in Haskell, and I want more :)
2020-10-27 14:00:45 <dminuoso> gothnbass: What do these definitions look like?
2020-10-27 14:01:19 × damianfral3 quits (~damianfra@174.red-37-13-187.dynamicip.rima-tde.net) (Ping timeout: 256 seconds)
2020-10-27 14:02:15 <gothnbass> They're stored in a Neo4j database, so a JSON object is pretty much their natural representation. I'd just use a Map, but they're heterogeneous.
2020-10-27 14:04:07 <dminuoso> gothnbass: If they're already in JSON, you could keep that as JSON directly?
2020-10-27 14:04:09 × invaser quits (~Thunderbi@31.148.23.125) (Remote host closed the connection)
2020-10-27 14:04:31 <dminuoso> Well, `Value` for instance
2020-10-27 14:04:32 × PlasmaStrike quits (~mattplasm@38.73.141.198) (Remote host closed the connection)
2020-10-27 14:04:38 <gothnbass> To be slightly less vague, the Haskell representation of one of them looks like `data Tag = Tag { uid :: String , createddate :: Int , original_uid :: String , description :: Maybe String } deriving (Show)`
2020-10-27 14:05:48 × akegalj quits (~akegalj@93-142-98-67.adsl.net.t-com.hr) (Quit: Lost terminal)
2020-10-27 14:06:06 roconnor joins (~roconnor@host-192.252-162-14.dyn.295.ca)
2020-10-27 14:06:12 PlasmaStrike joins (~mattplasm@38.73.141.198)
2020-10-27 14:06:57 knupfer joins (~Thunderbi@200116b82cb7c4008d74fd1dd144f3b4.dip.versatel-1u1.de)
2020-10-27 14:08:46 <gothnbass> It's a 2-layer app, where the layer closes to the DB is basically an engine that dynamically constructs a REST API according to whatever the DB says is valid. I started with porting the webapp first, which receives JSON objects, and is expected to deal with them on the fly. It _can_ fetch the schema via the API, but of course that's also a runtime operation.
2020-10-27 14:10:27 <gothnbass> But keeping them in JSON is an interesting idea. It hadn't occurred to me to parse them that far and no further. Thanks for the pointer!
2020-10-27 14:10:53 dbmikus joins (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com)
2020-10-27 14:11:08 <dminuoso> gothnbass: JSON/Value might not be an ideal format though.
2020-10-27 14:11:20 × acarrico quits (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net) (Ping timeout: 258 seconds)
2020-10-27 14:11:31 Chi1thangoo joins (~Chi1thang@87.112.60.168)
2020-10-27 14:13:00 <dminuoso> gothnbass: Maybe I misunderstood. Are the data in JSON, or the definitions?
2020-10-27 14:13:02 ddellacosta joins (~dd@86.106.121.168)
2020-10-27 14:13:23 <dminuoso> Also, can these things be nested? Can there be recursion?
2020-10-27 14:13:35 <dminuoso> (That is, can the data be cyclic)
2020-10-27 14:15:25 × dbmikus quits (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com) (Ping timeout: 240 seconds)
2020-10-27 14:15:50 <gothnbass> dminuoso: JSON's just a representation format, but is a good fit. Absolutely they can be nested and there can be recursion; it's part of the idea, so you can chase assocations from one node to another.
2020-10-27 14:17:33 invaser joins (~Thunderbi@31.148.23.125)
2020-10-27 14:18:09 <gothnbass> dminuoso: Because of this, I'm using JSON as the format for returning data from the API, as well as for representing the schema when a client calls on that API to find out what's in there. What I'm actually trying to port right now is the webapp on top of the API, which receives JSON and constructs HTML accordingly.
2020-10-27 14:18:48 <gothnbass> I'm basically putting a relational-inspired schema on top of a graph database, because you can't put one in there directly. This is the most practical (least impractical?) way I found of doing that.
2020-10-27 14:19:13 × PlasmaStrike quits (~mattplasm@38.73.141.198) (Ping timeout: 265 seconds)
2020-10-27 14:19:42 <dminuoso> It's mildly amusing, that people go to great length to ignore 50 years of research in relational databases, put up unstructured databases, and then there's folks like you putting effort into figuring out how to specify a schema for that.
2020-10-27 14:19:55 <gothnbass> I know, right? :)
2020-10-27 14:20:30 <Raito_Bezarius> :D
2020-10-27 14:20:40 texasmynsted joins (~texasmyns@99.96.221.112)
2020-10-27 14:20:43 acarrico joins (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net)
2020-10-27 14:21:19 <dminuoso> gothnbass: My first instinct, is to not think about JSON here.
2020-10-27 14:21:22 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2020-10-27 14:21:29 <gothnbass> I love relational databases, and have since I first administered a production one in '97, but there are problem-spaces for which they're just not a good fit. Graph DBs are a great fit for this space, but I've seen the mess that can result when the data definitions are scattered through the codebase, and nobody actually defined a clear data model.
2020-10-27 14:21:31 <dminuoso> JSON seems like a bad fit for a few reasons
2020-10-27 14:21:44 × cr3 quits (~cr3@192-222-143-195.qc.cable.ebox.net) (Ping timeout: 256 seconds)
2020-10-27 14:21:49 <dminuoso> If you want a graph, use proper graph data types.
2020-10-27 14:22:07 cr3 joins (~cr3@192-222-143-195.qc.cable.ebox.net)
2020-10-27 14:22:18 × ddellacosta quits (~dd@86.106.121.168) (Ping timeout: 260 seconds)
2020-10-27 14:22:36 ddellacosta joins (~dd@86.106.121.168)
2020-10-27 14:22:41 <dminuoso> gothnbass: So far, any excuse I've heard for unstructured databases is just "We are too lazy/unprincipled/messy"
2020-10-27 14:23:03 howdoi joins (uid224@gateway/web/irccloud.com/x-vkinnmkhoknarggj)
2020-10-27 14:23:24 <gothnbass> dminuoso: also, "but properly updating the schema is haaard!" Well, yes, it often is.

All times are in UTC.