Search Haskell Channel Logs

Friday, March 3, 2017

#haskell channel featuring kloppadop, the|auriscope, fDev2179, Tuplanolla, zennist, max3, and 7 others.

nitrix 2017-03-03 11:59:23
Does anyone with an intuition for genetic programming can look at the `moo` library (https://hackage.haskell.org/package/moo-1.0) and tell me how I'd have a fitness function that requires IO?
nitrix 2017-03-03 11:59:36
(Loading samples from network/disk to train the GA) ?
nitrix 2017-03-03 12:00:00
`ObjectiveFunction` seems to not have such thing.
nitrix 2017-03-03 12:01:25
Strangely, StepGA though lets you have a monad `m`.
nitrix 2017-03-03 12:01:36
I don't know how one would connect to twos.
fDev2179 2017-03-03 12:02:17
From what I know of optimization algorithms, there is no training.
nitrix 2017-03-03 12:02:44
fDev2179: I'm using a GA to train a NN :P
nitrix 2017-03-03 12:02:53
Sorry for overlapping the terminology a bit.
fDev2179 2017-03-03 12:03:01
Fitness function requiring IO, yes.
fDev2179 2017-03-03 12:03:23
I've done design optimization studies where I used an external analysis code to evaluate the objective function.
fDev2179 2017-03-03 12:03:48
Then, I have a separate code which drives the optimization.
nitrix 2017-03-03 12:04:10
I'm thinking the fitness function could take a lazy list of inputs as argument and be partially applied and given to the library, but it solves half the problem :/
fDev2179 2017-03-03 12:04:12
The analysis code writes results to a file which must be read.
nitrix 2017-03-03 12:04:29
fDev2179: The issue is having IO with that library in the first place.
nitrix 2017-03-03 12:04:48
I'm well competent with GA, no worries :)
fDev2179 2017-03-03 12:05:25
The way I've handled the communication is using files. For example, I write the inputs to a file which the analysis code reads. I'm confused about the question then.
nitrix 2017-03-03 12:06:49
fDev2179: The fitness function that the framework seems to work with isn't monadic.
nitrix 2017-03-03 12:07:37
I guess it is from ((->) r) but that wont get me anything usuable. I'd love to have a minimum support for effects of some kind.
fDev2179 2017-03-03 12:08:05
Ohhhh, I see.
nitrix 2017-03-03 12:08:09
class ObjectiveFunction f a where evalObjective :: f -> [Genome a] -> Population a
nitrix 2017-03-03 12:08:22
And the instances leads to nothing.
fDev2179 2017-03-03 12:08:26
That makes things difficult.
Cale 2017-03-03 12:08:35
Well, just being in *some* monad doesn't mean much -- control over which monad it is, is what you want :)
nitrix 2017-03-03 12:08:54
StepGA has ehm... m (StepResult (Population a))
Cale 2017-03-03 12:09:34
Yeah, it only extends as far as population management
nitrix 2017-03-03 12:09:55
But I'm not sure how I can use this. I think I'd load the dataset in this stepping function between current and next generation and partially apply the fitness function?
nitrix 2017-03-03 12:10:55
This way it can run the Genome agaisn't some data set. That _should_ work?
Cale 2017-03-03 12:13:00
I wouldn't bother with that. Just grab the code and start changing it so that the fitness function is in the same monad m.
Cale 2017-03-03 12:16:17
So it becomes something like class ObjectiveFunction m f a where evalObjective :: f -> [Genome a] -> m (Population a)
nitrix 2017-03-03 12:16:29
Mhm.
the|auriscope 2017-03-03 12:17:11
hi all. I've been fooling with haskell on and off for a few months, and wanted to say "hi"
kloppadop 2017-03-03 12:17:24
does anyone know of a nice, clean implementation of a parser for an indentation sensitive language like haskell?
c_wraith 2017-03-03 12:17:35
hello, the|auriscope
kloppadop 2017-03-03 12:17:45
the haskell lexer and parser are a complete mindfuck
fDev2179 2017-03-03 12:17:55
Hi, the|auriscope.
nitrix 2017-03-03 12:18:39
kloppadop: Languages do get fairly complicated when they grow beyond the pet toy project phase.
nitrix 2017-03-03 12:18:54
kloppadop: Haskell's parser and lexers are actually very clean and well documented.
the|auriscope 2017-03-03 12:19:07
does anyone have opinions on books for learning Haskell?
kloppadop 2017-03-03 12:19:12
nitrix: lol no they arent
kloppadop 2017-03-03 12:19:21
they are needlessly complex and brittle af
kloppadop 2017-03-03 12:19:36
https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Parser
max3 2017-03-03 12:20:20
solution to all of my problems: liftIO all the things!
kloppadop 2017-03-03 12:20:56
' if we encounter an error in parsing, we try exiting an indentation context and trying again'
kloppadop 2017-03-03 12:20:58
kek
zennist 2017-03-03 12:21:29
anyone knows how to hide the imported modules in the prompt inside ghci when inside a multiline block?
zennist 2017-03-03 12:21:33
this has been annoying...
c_wraith 2017-03-03 12:21:50
ghc's parser is complicated by all the extensions it supports that add syntax.
kloppadop 2017-03-03 12:22:06
zennist: :set prompt "\ESC[34mλ> \ESC[m"
zennist 2017-03-03 12:22:28
kloppadop: yeah but that doesn't hide the list when inside a multiline block started with :{
kloppadop 2017-03-03 12:22:29
c_wraith: yeah I understand that theres a lot of complexity, thats why im looking for something more minimalistic
kloppadop 2017-03-03 12:22:32
but with a similar layout
zennist 2017-03-03 12:23:24
oh got it! :set prompt2 "..."
zennist 2017-03-03 12:23:34
can't believe no one mentioned it in any blog!
kloppadop 2017-03-03 12:24:15
purescript seems to have a much cleaner lexer/parser implementation
Tuplanolla 2017-03-03 12:26:30
It was added fairly recently, zennist.
codedmart 2017-03-03 12:27:12
I renamed a file, changed it everywhere in my project but now stack errors `Failed to load interface for 'Lib.Auth'`. I have removed my `.stack-work` dir and rebuild but this error still happens.
codedmart 2017-03-03 12:27:20
Any ideas what I am missing here. I have never had this happen which leads me to believe it is something stupid I am overlooking since I am tired.
kloppadop 2017-03-03 12:28:43
codedmart: do you export the module in your .cabal file?
kloppadop 2017-03-03 12:28:53
and does the module name match the path?
geekosaur 2017-03-03 12:29:05
that sounds like you misunderstood the question tbh
geekosaur 2017-03-03 12:29:29
I'd probably be looking for .hi files containing the old name
codedmart 2017-03-03 12:30:15
@geekosaur wouldn't deleting the .stack-work dir remove those?
lambdabot 2017-03-03 12:30:16
Unknown command, try @list
geekosaur 2017-03-03 12:32:19
sometimes? iirc it's a bit more complex than that
kloppadop 2017-03-03 12:32:28
https://mail.haskell.org/pipermail/haskell-cafe/2009-April/060670.html
geekosaur 2017-03-03 12:32:29
but you probably want someone who knows more stack internals there
kloppadop 2017-03-03 12:32:43
'the complete offside rule as found in Haskell is almost impossible to get right.'
geekosaur 2017-03-03 12:32:58
kloppadop, that was fixed in haskell2010
kloppadop 2017-03-03 12:33:13
geekosaur: what do you mean?
geekosaur 2017-03-03 12:33:20
although I think I should save that thread pointer for next time the discussion comes up
kloppadop 2017-03-03 12:33:24
geekosaur: the off-side rules were changed?
geekosaur 2017-03-03 12:33:28
yes
kloppadop 2017-03-03 12:33:39
geekosaur: is there somewhere where they are 'formally' documented?
geekosaur 2017-03-03 12:33:42
someone actually found a case where hugs and ghc produced different valid parses
geekosaur 2017-03-03 12:33:59
(valid meaning satisfied the haskell98 report)
kloppadop 2017-03-03 12:33:59
oh hugs, I should look at that parser
geekosaur 2017-03-03 12:35:02
https://www.haskell.org/onlinereport/haskell2010/haskellch10.html#x17-17800010.3
kloppadop 2017-03-03 12:35:12
great, thanks geekosaur
geekosaur 2017-03-03 12:35:15
formal specification of the haskell2010 layout rule
geekosaur 2017-03-03 12:37:35
also note that ghc does not fully follow it by default, because it enables the NondecreasingIndentation extension by default. another extension affecting it is DoAndIfThenElse.
geekosaur 2017-03-03 12:39:15
...wait, did NondecreasingIndentation go away in 8.x?
kloppadop 2017-03-03 12:39:55
I wonder if it would be noticeably simpler only indentation layout was supported, (without curly braces), and the layout rules were more strict
kloppadop 2017-03-03 12:40:05
if only*
geekosaur 2017-03-03 12:40:37
first you have to rewire SPJ's brain :p
hpc 2017-03-03 12:40:39
geekosaur: what was the case that produces different valid parses?
geekosaur 2017-03-03 12:41:05
I don;t recall,t hat's why I want to go through the thread pointed to earlier because I couldn't find it last time I looked and I'm hoping that thread has it
geekosaur 2017-03-03 12:42:35
it's also possible that it was nhc98 involved instead of hugs
geekosaur 2017-03-03 12:42:59
except that that late someone would have had a fair amount of work to do to get that working for people to reproduce it :)