ertes 2017-01-31 04:47:48
orion: none that i know of, but i've implemented a function that waits until a certain point in time, which you might find useful
ertes 2017-01-31 04:48:20
orion: https://hackage.haskell.org/package/timelike-0.2.2/docs/Data-Time-Class.html#g:5
ertes 2017-01-31 04:48:25
see delayUntil
tsahyt 2017-01-31 05:00:53
ertes: I've been looking at the wires github repo again lately. Is it still being developed?
Guest74313 2017-01-31 05:03:26
Hi
Guest74313 2017-01-31 05:04:03
Does anyone have a simple example for how to build a boolean expression parser in haskell?
tsahyt 2017-01-31 05:04:48
Guest74313: what parser library are you using?
tsahyt 2017-01-31 05:05:17
if you're using Megaparsec, you might want to look at the Text.Megaparsec.Expr module, which aids in building expression parsers
orion 2017-01-31 05:05:34
ertes: Thank you.
Guest74313 2017-01-31 05:05:51
tsahyt: but I need a library for do that?
tsahyt 2017-01-31 05:06:16
Guest74313: you don't *need* a library to do anything, but usually you'd use a library for building parsers, yeah.
tsahyt 2017-01-31 05:06:28
Even just using the stuff in base is technically using a library
Guest74313 2017-01-31 05:07:18
Ok, but I have to do the parser using the standard library as an exercise for school course
Guest74313 2017-01-31 05:07:35
So I don't think that I can use an external library
tsahyt 2017-01-31 05:07:48
there's stuff to build parser combinators in base too. Look at Text.ParserCombinators.ReadP
tsahyt 2017-01-31 05:08:14
in particular I think the chain* combinators are what you want for expression parsing
Guest74313 2017-01-31 05:08:34
tsahyt: thanks
tsahyt 2017-01-31 05:10:01
@hoogle assertM
lambdabot 2017-01-31 05:10:02
module Test.Framework.AssertM
lambdabot 2017-01-31 05:10:02
Test.Framework.AssertM class Monad m => AssertM m
lambdabot 2017-01-31 05:10:02
Control.Error.Safe assertMay :: Bool -> Maybe ()
byorgey 2017-01-31 05:10:12
Guest74313: if you are supposed to build a parser using stuff in the base library, then probably the intention is not for you to use ReadP.
byorgey 2017-01-31 05:10:25
Guest74313: without knowing more about your assignment and what you have tried already it is very hard for us to help.
tsahyt 2017-01-31 05:10:32
hmm, I suppose when I want assertions in monadic code, I should use assert foo (return ()) then or so?
byorgey 2017-01-31 05:11:52
tsahyt: sure
byorgey 2017-01-31 05:12:03
you can put anything as the second argument.
tabaqui1 2017-01-31 05:12:18
question for an interview:
tsahyt 2017-01-31 05:12:21
with optimizations on, this gets transformed to return (), which should get optimized out in a next step then, right?
reactormonk 2017-01-31 05:12:42
Anything against just using the lens hackage package?
tabaqui1 2017-01-31 05:12:43
is (_:x:_) a butt-sign or a valid Haskell construction?
tsahyt 2017-01-31 05:13:06
tabaqui1: it's valid
byorgey 2017-01-31 05:13:09
tsahyt: quite possibly, but if it really matters you would have to look at the generated core
MarcelineVQ 2017-01-31 05:13:12
when you just want number 2...
tabaqui1 2017-01-31 05:13:15
tsahyt: I know)
tabaqui1 2017-01-31 05:13:22
first comment from thread
tabaqui1 2017-01-31 05:13:33
butt is a valid Haskell construction
byorgey 2017-01-31 05:13:35
tabaqui1: if that was supposed to be a joke, it's not very funny.
Guest74313 2017-01-31 05:16:58
byorgey: "without knowing more about your assignment" the only assignment is to build a parser for boolean expression. Nothing more
byorgey 2017-01-31 05:17:17
Guest74313: your assignment literally says "Build a parser for boolean expressions." ?
Guest74313 2017-01-31 05:17:24
Yes
byorgey 2017-01-31 05:17:32
just those six words?
Guest74313 2017-01-31 05:18:14
nothing more
byorgey 2017-01-31 05:18:45
Guest74313: have you talked about boolean expressions in class? have you talked about parsers?
merijn 2017-01-31 05:19:05
If I wanna rate limit, e.g. outgoing HTTP requests any suggestions? Do I just allocate a QSem and have a thread periodically incrementing it while all HTTP queries requiring a decrement on it before sending the request?
Guest74313 2017-01-31 05:19:37
byorgey: Yes but not in haskell. we have built a parser in java
Guest74313 2017-01-31 05:20:17
byorgey: so I'm looking something to start to create my own parser
byorgey 2017-01-31 05:20:23
Guest74313: ok. And how did the java parser work?
byorgey 2017-01-31 05:20:42
Was it a recursive descent parser? Or did you use some kind of parser framework?
mrkgnao 2017-01-31 05:21:20
I'm working with a simple monad transformer stack for the first time, and it seems like things are finally making sense. Plus lenses, woo!
mrkgnao 2017-01-31 05:22:29
I'm so happy %= exists. I had a ton of modify $ thing %~ f lines everywhere.
byorgey 2017-01-31 05:23:28
mrkgnao: =D
joeyh 2017-01-31 05:24:34
bitemyapp: you fixed esqueleto?!
joeyh 2017-01-31 05:24:37
big hug!
reactormonk 2017-01-31 05:30:35
Is there `a -> List a`?
byorgey 2017-01-31 05:31:39
reactormonk: sure, e.g. \x -> [x]
byorgey 2017-01-31 05:31:53
reactormonk: you can also write return or (:[])
reactormonk 2017-01-31 05:31:54
so no built-in function?
kadoban 2017-01-31 05:31:57
'pure' or '(:[])' or that, or repeat (you probably don't want that one though)
byorgey 2017-01-31 05:32:05
> return 1 :: [Int]
lambdabot 2017-01-31 05:32:08
[1]
reactormonk 2017-01-31 05:32:08
ah, works
orzo 2017-01-31 05:32:14
does it have a runtime cost to add a bang (!) to something that will be evaluated strictly anyway?
tsahyt 2017-01-31 05:33:07
orzo: will it be evaluated right then and there?
orzo 2017-01-31 05:33:41
well suppose you use $! to apply a function that itself used ! on the argument
tsahyt 2017-01-31 05:34:26
as far as I know that shouldn't incur any extra cost
tsahyt 2017-01-31 05:35:00
orzo: but when in doubt, benchmark
c_wraith 2017-01-31 05:42:55
it can add extra cost.
c_wraith 2017-01-31 05:43:25
it may not, depending on whether the optimization passes notice the same thing is being done twice in a row.