dmwit 2017-02-06 10:45:15
:t getAlt . foldMap Alt
lambdabot 2017-02-06 10:45:18
forall k (f :: k -> *) (a :: k) (t :: * -> *). (Monoid (Alt f a), Foldable t) => t (f a) -> f a
dmwit 2017-02-06 10:45:45
the uglier spelling of asum =P
jle` 2017-02-06 10:46:09
haha
jle` 2017-02-06 10:46:32
:t ala Alt foldMap
lambdabot 2017-02-06 10:46:34
forall k (t :: * -> *) (g :: k -> *) (b :: k). (Monoid (Alt g b), Foldable t) => t (g b) -> g b
AWizzArd 2017-02-06 10:54:08
What is the style in which Haskell apps for production are typically written? I am coming from Clojure/Lisp, and there development mostly takes place in the repl. Patches are for some applications applied while it is running. Is Haskell mostly edit/compile/run?
BernhardPosselt 2017-02-06 10:54:41
AWizzArd: i suppose people use some form of tdd
dmwit 2017-02-06 10:57:16
I use the REPL for a lot of stuff. I use compile/run for a lot of stuff, too.
AWizzArd 2017-02-06 10:58:14
dmwit: I imagine that if the program gets bigger that compile times increase.
dmwit 2017-02-06 10:58:34
Usually not much. GHC is pretty good about only recompiling files that changed.
ongy 2017-02-06 10:58:39
they do, but ghc is pretty good with incremental builds
AWizzArd 2017-02-06 10:58:47
Ah okay, good, that makes sense.
dmwit 2017-02-06 10:58:58
And most development time is spent at the leaves of the project, not the core files that force everything to get rebuilt.
jle` 2017-02-06 11:02:34
i usually edit with a repl open to test my changes immediately
monochrom 2017-02-06 11:05:47
I can understand why and how one would write millions of lines of Lisp code at a REPL prompt. Because most Lisp REPLs come with a "save heap as exe" command. (In fact likely the only way to obtain an exe.)
monochrom 2017-02-06 11:06:11
Such messy magic is not replicated in the Haskell world. Nor even the Python world.
HaskellLord69 2017-02-06 11:06:16
is there a way to see the type of a variable by hovering over it with the mouse in emacs/spacemacs?
mahmoudgebril 2017-02-06 11:06:48
9 11 attacks, Did USA do it itself or it just let it happen?
mahmoudgebril 2017-02-06 11:06:48
Did USA administration murder 3000 American citizen in 9 11 attacks to justify starting a war against iraq?
mahmoudgebril 2017-02-06 11:06:48
If al-qaeda did it, why go to kill 2 million Iraqi?
mahmoudgebril 2017-02-06 11:06:48
http://creatvchaos.blogspot.com.eg/
mahmoudgebril 2017-02-06 11:06:48
https://creatvchaos.wordpress.com/
mahmoudgebril 2017-02-06 11:06:48
Some of the benefits Americans say they achieved after 9 11 attacks include:
mahmoudgebril 2017-02-06 11:06:48
*constant flow of oil, which price is in continuous decline. Trump said he will simply take the Iraqi oil, and when he was told that Iraqi oil belongs to iraq he said there is no iraq(after usa destroyed it ).
mahmoudgebril 2017-02-06 11:06:49
*Invasion of afghanstan with construction of not less than 14 american military base which give a close eye on china.
mahmoudgebril 2017-02-06 11:06:49
*Removal of potential threat to isreal represented in iraq which throw isreal with more than 30 rocket after American assault on iraq during 2nd gulf war.
EvanR 2017-02-06 11:07:17
linking times are still kind of a
Tuplanolla 2017-02-06 11:07:52
Usually it's edit-compile-edit-compile-edit-compile-run instead of edit-compile-run though, AWizzArd.
ongy 2017-02-06 11:08:20
Tuplanolla: you mean, edit, typeerror, edit typeerror, edit typeerror, edit compile run?
Tuplanolla 2017-02-06 11:08:30
Yes.
monochrom 2017-02-06 11:09:12
But even the 2nd most advanced Lisp REPL would fail on the question "now how do I edit code I wrote 5 power cycles ago?"
Tuplanolla 2017-02-06 11:09:21
Many people like to offload compilation to a daemon like `ghcid` too, so for you it's mostly edit-edit-edit-run.
monochrom 2017-02-06 11:09:40
(The 1st most advanced one addressed this by being a full-fledged editor itself --- emacs.)
xcmw 2017-02-06 11:09:51
Is it possible to use stack with ghc head (8.1)?
monochrom 2017-02-06 11:10:22
So basically REPL programming doesn't scale and is a dead end. You need to grow out of it.
AWizzArd 2017-02-06 11:11:47
monochrom: it may depend on the situation. We have a server app that has a long startup time. Several times a day I make small fixes/additions and just load the updated file.
mizu_no_oto_work 2017-02-06 11:13:21
monochrome: repl-driven-development in Haskell typically uses ':r' in ghci a lot.
monochrom 2017-02-06 11:13:55
Sure. By my "REPL programming" doesn't mean that.
mizu_no_oto_work 2017-02-06 11:13:59
monochrom: i.e. edit/reload in repl/interact
monochrom 2017-02-06 11:14:20
s/By/But/
mizu_no_oto_work 2017-02-06 11:15:58
AWizzArd: when you say "development mostly happens in the REPL", do you mean that you write code in a file, reload it in the repl, test it by hand, and upload it to a running app?
hexagoxel 2017-02-06 11:16:21
what kind of equality is used in type class laws?
monochrom 2017-02-06 11:16:31
mathematical equality
monochrom 2017-02-06 11:17:08
most often it comes down to "are the same under the usual denotational semantics" if you want more detail.
dolio 2017-02-06 11:17:31
Or whatever semantics you care about.
Tuplanolla 2017-02-06 11:17:36
This is sometimes called judgmental equality, no?
AWizzArd 2017-02-06 11:17:38
mizu_no_oto_work: typically when writing new functions I start doing this in the repl. Or I write them in a file and load them. This is what I do in Lisp/Clojure, but also with my tiny Haskell programs that I'm developing.
NemesisD 2017-02-06 11:18:15
hi yall. I have what's essentially an Acquire (IO (Maybe a)) that i'm trying to rig up to a conduit so that it yields every a. The problem is that Acquire requires you to either have MonadMask or MonadBaseControl which aren't available for conduit
mizu_no_oto_work 2017-02-06 11:18:17
AWizzArd: after you write and test a bit, thought, you copy/paste it to the file?
AWizzArd 2017-02-06 11:18:34
mizu_no_oto_work: about a running app: hundreds of files are loaded. I change one function locally on my dev system, and call the updated fn to see that it works. I then push the patch and pull it on the server. There I reload the file. This overwrites the old function definition with the new one.
NemesisD 2017-02-06 11:18:52
is there any sort of ContT or some other trick i can do to in IO get each element and then pass it to conduit's yield? Right now I use a TBMQueue and a separate thread which seems pretty horrible
AWizzArd 2017-02-06 11:19:16
mizu_no_oto_work: yes. In the repl I not necessarily write the function, but call it a few times, to see how it behaves. This is also what I do in Haskell. I write it in Emacs and call it in the ghci repl.
dolio 2017-02-06 11:19:28
Judgmental equality has to do with the formalism of type theory, and may not correspond to what people care about in type classes.
jophish 2017-02-06 11:19:40
is Gabriel on IRC?
NemesisD 2017-02-06 11:20:00
to use Acquire i have to use with :: MonadBaseControl IO m => Acquire a -> (a -> m b) -> m b. M is IO so I can't see how to use that and call yield within the continuation since m is IO
monochrom 2017-02-06 11:20:03
This sounds like two separable concerns. How to create a file, and how to tell the server to hot-swap a file.
AWizzArd 2017-02-06 11:20:08
mizu_no_oto_work: and in the Lisp app: all data is untouched. Just the old function is replaced by the new one, the server continues to work, and users don't notice that anything got updated. They only see that there is new functionality.
dolio 2017-02-06 11:20:44
For instance, the formalism of something like Haskell wouldn't ever need to make reference to term equality.
mizu_no_oto_work 2017-02-06 11:21:04
AWizzArd: Yeah, I think that's a really common development workflow in Haskell. Hot swapping code isn't related to the REPL in Haskell, though.
dolio 2017-02-06 11:21:32
Although it might define some compute rules which give rise to 'equal' terms, but even then that might not be the equality you care about.
EvanR 2017-02-06 11:21:46
is judgmental equality the same as term equality is the same as definitional equality is the same as computational equality
AWizzArd 2017-02-06 11:22:07
mizu_no_oto_work: I will have to get used to implement the program in such a way that the current app state can be reconstructed quickly when the app is restarted. Also will have to think about how to restart without downtimes.
AWizzArd 2017-02-06 11:22:24
But till I can do this I will continue my basic Haskell studies (:
Tuplanolla 2017-02-06 11:22:33
Throw propositional equality to the mix too, EvanR.
dolio 2017-02-06 11:22:50
Judgmental equality is the stuff that look like `Gamma |- X = Y` in your type theory.
dolio 2017-02-06 11:23:05
Or `Gamma |- X = Y : T` possibly.
dolio 2017-02-06 11:23:31
The judgments that two things are equal according to the theory.
hexagoxel 2017-02-06 11:23:34
i wonder if i am supposed to have any idea what "mathematical equality" means.
monochrom 2017-02-06 11:24:32
It is natural to not know. Because the mathematicians never spelt it out, but apparently they still manage to have an impressive consensus.
monochrom 2017-02-06 11:25:29
This is why I then had to augment with "use a denotational semantics".
hexagoxel 2017-02-06 11:26:47
"mathematical equality" sounds to me like it does not care what stuff is exposed by my modules. but denotation semantics would care about what constructs you expose, wouldn't it?
mizu_no_oto_work 2017-02-06 11:26:57
AWizzArd: In Haskell apps, state would usually be stored externally to the code.
hsk3 2017-02-06 11:27:04
Honest question. We have Stack scripts, https://haskell-lang.org/tutorial/stack-script
hsk3 2017-02-06 11:27:04
So why would I ever again want to write Bash scripts?
mizu_no_oto_work 2017-02-06 11:27:43
AWizzArd: e.g. in a database or something
monochrom 2017-02-06 11:28:15
No, it sounds like both are about what you expose.
sm 2017-02-06 11:28:30
hsk3: for situations when installing/using stack & haskell is considered a burden
AWizzArd 2017-02-06 11:28:33
mizu_no_oto_work: of course, in Lisps this is the same. But when the app starts it will fetch hundreds of megabytes of data in order to not have to contact the db for future requests.
monochrom 2017-02-06 11:28:49
Take for example Data.Ratio. What does it mean for 2%3 and 4%6 to be "equal"?
hsk3 2017-02-06 11:28:51
sm, yes that's the only situation i can imagine :)
sm 2017-02-06 11:28:58
I'm loving them too
AWizzArd 2017-02-06 11:29:20
mizu_no_oto_work: if you need 20 mins time to fill the cache you don't want to restart your app often.
mizu_no_oto_work 2017-02-06 11:29:40
That's what something like redis is for.
sm 2017-02-06 11:30:35
hsk3: also, when haskell is just too verbose. They do tend to have relatively high boilerplate for small scripts
hsk3 2017-02-06 11:30:36
true
hexagoxel 2017-02-06 11:30:44
monochrom: ok, that makes sense, thanks.
monochrom 2017-02-06 11:30:50
I deplore stack scripts. Why should I download GHC one more time just to print "hello world".
AWizzArd 2017-02-06 11:31:01
mizu_no_oto_work: sure, but it didn't exist in 2004.
monochrom 2017-02-06 11:31:11
(And yes stack always downloads GHC one more time than I like.)
sm 2017-02-06 11:31:22
which is unfortunate. We could reduce that boilerplate a bit
barrucadu 2017-02-06 11:33:13
hsk3: My main use of shell scripting is for things which are mostly a sequence of invocations of other programs. Pretty much every language is significantly more verbose than the shell for that.
AWizzArd 2017-02-06 11:33:13
mizu_no_oto_work: also, our system requires tens of thousands of templates to be in memory, to check if we match against them. It's by far too slow to have something like Redis in between.
hsk3 2017-02-06 11:33:31
barrucadu good point
hsk3 2017-02-06 11:33:54
so i guess i have to learn bash scripting after all lol
barrucadu 2017-02-06 11:34:07
Which makes sense. The shell, despite all its problems, is a pretty good DSL for chaining other programs together.
maksim_ 2017-02-06 11:34:26
can someone help me with this http://pastebin.com/vM6yk5HZ
maksim_ 2017-02-06 11:34:45
this is cabal.config https://github.com/databrary/databrary/blob/master/cabal.config
maksim_ 2017-02-06 11:34:53
and my cabal file https://github.com/databrary/databrary/blob/master/databrary.cabal
sm 2017-02-06 11:35:06
monochrom: I think that was rhetorical, but your hello world script will of course in time grow into a bug-ridden monster requiring expensive specialist bash knowledge your team does not have in house :)
barrucadu 2017-02-06 11:36:10
sm: I like to avoid the "in time" and jump straight to writing scripts requiring specialise zsh knowledge.
monochrom 2017-02-06 11:36:54
No, runghc scripts and runhugs scripts would do fine when that happens.
maksim_ 2017-02-06 11:37:01
i don't understand why file-embed 0.0.9.1 doesn't satisfy the constraints
sm 2017-02-06 11:37:25
a stack script just adds the ability to depend on packages besides base
sm 2017-02-06 11:38:03
which is quite a big deal actually
kadoban 2017-02-06 11:38:34
And removes the requirement that users always have the correct version of GHC themselves and etc. Though I'm not sure I'd really deploy a script like that to most users.
sm 2017-02-06 11:41:52
stack scripts don't have to install GHC, of course. It's configurable.
AWizzArd 2017-02-06 11:42:59
The Learn You A Haskell book says "Therefore, doing fmap (*) (Just 3) results in Just ((*) 3), which can also be written as Just (* 3) if we use sections." – shouldn't it be Just (3 *) instead?
Tuplanolla 2017-02-06 11:43:21
Yes, AWizzArd.
AWizzArd 2017-02-06 11:43:47
k
Tuplanolla 2017-02-06 11:44:31
Generally though people assume `*` to be symmetric.