dolio 2017-03-02 13:45:16
This wouldn't be the first time someone has put a Haskell book they haven't written on Amazon, I think.
robkennedy 2017-03-02 13:46:41
It's worth the effort, if you can afford to expend it - Haskell lives because of SPJ, and Simon Marlow, and Bryan O'Sullivan, giving humanity the man-hours
robkennedy 2017-03-02 13:46:54
(and many many many others
mmaruseacph2 2017-03-02 13:47:24
wow, plagiarism even here :(
metalbot 2017-03-02 13:48:06
ah - found "infringement@oreilly.com" address :)
robkennedy 2017-03-02 13:48:28
Not here. Plagiarism is not the fault of the producers. Don Stewart didn't wear anything to ask for it ;)
robkennedy 2017-03-02 13:49:21
metalbot: thanks
dmj` 2017-03-02 13:49:27
world haskell ?
dolio 2017-03-02 13:49:38
Easy publishing lowers the bar for profitability, I imagine.
dolio 2017-03-02 13:50:05
Like spam.
mmaruseacph2 2017-03-02 13:52:26
robkennedy: I know
mmaruseacph2 2017-03-02 13:52:39
metalbot: sent them an email, the more the merrier :)
mmaruseacph2 2017-03-02 13:53:07
*the easier will be for them to see that it is an issue they need to tackle
clmg 2017-03-02 14:28:35
How do I make a "reference" in Haskell such that when I change one field of a record it updates that same field of another record?
clmg 2017-03-02 14:30:02
In C terms: I want my object (record) to have a field whose value is a pointer to another object (record).
pacak 2017-03-02 14:30:25
MVar, IORef
jle` 2017-03-02 14:30:50
is there a common term for something like (a, b) -> Either c d -> Either (a, c) (b, d)
pacak 2017-03-02 14:31:00
STRef, TVar
clmg 2017-03-02 14:31:11
pacak: is there a more "haskell" way to accomplish this?
clmg 2017-03-02 14:31:22
pacak: rather than actually having references/pointers?
jle` 2017-03-02 14:31:33
mvars/iorefs are pretty 'haskell'
jle` 2017-03-02 14:31:39
but it's hard to tell if there's a better way without more context
pacak 2017-03-02 14:31:43
clmg: Referential transparency is a nice thing.
jle` 2017-03-02 14:31:55
you're just giving us a very narrow/thin slice and from this perspective, mvar/ioref is the naive answer
dolio 2017-03-02 14:32:33
:t uncurry $ \x y -> bimap (x,) (y,)
lambdabot 2017-03-02 14:32:37
Bifunctor p => (t, t2) -> p t1 t3 -> p (t, t1) (t2, t3)
clmg 2017-03-02 14:32:53
pacak: I have two data constructors: window and buffer. Windows need to have buffers, but a buffer can be shared between two windows. I want it so that when one window edits its buffer, the other windows which ahve that buffer get updated also.
clmg 2017-03-02 14:33:14
pacak: all I can think of is passing around the list of buffers and storing the buffer index in the window. But that's cumbersome.
jle` 2017-03-02 14:33:19
dolio: i can implement it, i just was wondering if there was some name
Anthaas 2017-03-02 14:33:27
~ books
Anthaas 2017-03-02 14:33:31
! books
jle` 2017-03-02 14:33:35
what i'm actually doing is "zipping" (?) an n-ary product with an n-ary sum
Anthaas 2017-03-02 14:33:37
bot?
ski 2017-03-02 14:34:08
clmg : you could have windows include buffer identifiers, and have a separate data structure mapping buffer identifiers to buffer contents
jle` 2017-03-02 14:34:09
so like Tuple '[a,b,c,d] -> Sum '[e,f,g,h] -> Sum '[(a,e), (b f), (c, g), (d, h)]
Anthaas 2017-03-02 14:34:20
Meh, Hi guys - I have literally 0 experience with FP outside of Java 8 - can anyone suggest the "canonical" books which can explain everything from the start?
clmg 2017-03-02 14:34:36
Anthaas: I found learn you a haskell helpful.
ski 2017-03-02 14:35:13
Anthaas : i learned the basics from "Haskell: The Craft of Functional Programming" by Simon Thompson
Anthaas 2017-03-02 14:35:14
Im sort of looking for language agnostic, but with examples in a popular language/practice questions, etc.
clmg 2017-03-02 14:35:19
ski: how do I avoid passing that separate data structure around the entire application? Basically everything my application does works on a (buffer, window) pair.
robkennedy 2017-03-02 14:35:26
Arthaas: Learn You A Haskell and Parallel and Concurrent Programming in Haskell
jle` 2017-03-02 14:35:43
there's also haskellbook that is popular these days
psilo2 2017-03-02 14:35:44
I've got got this in an example xmonad config and can't find any explanations of the =<< operator: main = xmonad =<< statusBar myBar myPP toggleStrutsKey myConfig Can anybody explain (or tell me what I should be googling for)?
jle` 2017-03-02 14:35:48
@where haskellbook
lambdabot 2017-03-02 14:35:48
http://haskellbook.com
Nolrai 2017-03-02 14:36:52
What is Typeable1 as compared to Typeable?
ski 2017-03-02 14:36:53
clmg : `State'/`StateT' .. or `ST' or `IO'
psilo2 2017-03-02 14:36:56
Similarly, I've seen <+> somewhere (can't find it now) and not finding that in haskell syntax documentation
clmg 2017-03-02 14:37:19
ski: https://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-State-Lazy.html
robkennedy 2017-03-02 14:37:21
Bah humbug @haskellfromfirstprincipals
clmg 2017-03-02 14:37:21
that?
jle` 2017-03-02 14:37:21
psilo2: it's not a part of syntax
jle` 2017-03-02 14:37:26
psilo2: it's probably a custom defined operator
ski 2017-03-02 14:37:39
Nolrai : `Typeable1' is for types of kind `* -> *'
Nolrai 2017-03-02 14:37:46
Ah.
monochrom 2017-03-02 14:37:55
psilo2: "y =<< x" = "x >>= y"
ski 2017-03-02 14:37:58
clmg : that's one possibility
psilo2 2017-03-02 14:38:13
jle`: AH! So the Xmonad core source/docs is where I need to be looking. thanks!
jle` 2017-03-02 14:38:21
no problem!
jle` 2017-03-02 14:38:33
custom operaters are always one of the "ugh really" moments when you are trying to read code heh
jle` 2017-03-02 14:38:36
in haskell at least
Nolrai 2017-03-02 14:38:37
Wait ...why is that exported from Contro.Monad.Exceptions, but Typeable or Typeable0 isn't?
Nolrai 2017-03-02 14:38:57
jle' : I dont agree.
robkennedy 2017-03-02 14:39:08
:t (undefined :: Show a => a ->
lambdabot 2017-03-02 14:39:11
error:
lambdabot 2017-03-02 14:39:11
parse error (possibly incorrect indentation or mismatched brackets)
Nolrai 2017-03-02 14:39:12
They are just infix functions.
Fairy 2017-03-02 14:39:38
I'm feeling a bit stupid, but I'm trying to create a function notFollowedBy :: Parser b a -> Parser b () and I can't for the life of me figure it out :S
psilo2 2017-03-02 14:39:50
monochrom: that makes sense, since you seem to be familiar with it already, is it correct that it comes from the xmonad libraries and not haskell?
slaterr 2017-03-02 14:40:15
@hoogle <+>
lambdabot 2017-03-02 14:40:17
Control.Arrow (<+>) :: ArrowPlus a => a b c -> a b c -> a b c
lambdabot 2017-03-02 14:40:17
Language.Haskell.TH.PprLib (<+>) :: Doc -> Doc -> Doc
lambdabot 2017-03-02 14:40:17
Text.PrettyPrint (<+>) :: Doc -> Doc -> Doc
jle` 2017-03-02 14:40:17
Nolrai: yes, it's true that they are just infix functions
jle` 2017-03-02 14:40:18
but that doesn't magically make them readable
monochrom 2017-03-02 14:40:23
>>= is a commonly used operator in most Haskell code.
Nolrai 2017-03-02 14:40:27
I guess it depends on how useful you find names.
psilo2 2017-03-02 14:40:29
Might be time to finally learn a bit of Haskell after a couple years of stumbling through my xmonad configs.
jle` 2017-03-02 14:40:33
"infix functions are readable functions" is not a logical conclusion i'd make
robkennedy 2017-03-02 14:40:42
:t undefined :: Show a => a -> String
lambdabot 2017-03-02 14:40:44
Show a => a -> String
monochrom 2017-03-02 14:40:45
But <+> is more custom-made.
jle` 2017-03-02 14:40:46
functions don't become readable just because they're infix
Nolrai 2017-03-02 14:40:52
No..
psilo2 2017-03-02 14:40:58
monochrom: right I see that but what about =<
Nolrai 2017-03-02 14:41:01
I never said that.
Nolrai 2017-03-02 14:41:18
(=<<) = flip (>>=)
jle` 2017-03-02 14:41:21
"i don't agree that they are bad; they are infix functions"
monochrom 2017-03-02 14:41:28
=<< is less common but sometimes people want it for the other operand order.
jle` 2017-03-02 14:41:34
sorry, sort of implicitly injected a "because" in the middle there :)
jle` 2017-03-02 14:41:45
*i sort of
Nolrai 2017-03-02 14:42:01
jle': Yes I don't find worse then normal functions, nor do I find them better.
monochrom 2017-03-02 14:42:15
Put it this way. >>= has been in the standard library for a long time. =<< is a fairly recent addition, but still to the standard library. <+> is custom-made.
psilo2 2017-03-02 14:42:24
monochrom: Ah ok, I'm just looking at http://www.imada.sdu.dk/~rolf/Edu/DM22/F06/haskell-operatorer.pdf and I suppose they fairly considered it obvious what =<< is after defining >>=
dolio 2017-03-02 14:42:29
(=<<) is not recent.
psilo2 2017-03-02 14:42:57
Thanks for everyone's input. this stuff's kinda hard to google sometimes (for me apparently)
Nolrai 2017-03-02 14:43:13
A couple of your responces only made sense if I said I liked operators /better/ then normal functions.
monochrom 2017-03-02 14:43:28
It is hard to Google. But xmonad assumes a fair bit of Haskell knowledge.
Nolrai 2017-03-02 14:43:43
(Though googleability is a real issue with operators.)
monochrom 2017-03-02 14:43:50
"Our config file is just a Haskell code file!"
monochrom 2017-03-02 14:44:10
Imagine if Windows config were "just a cmd.exe script".
monochrom 2017-03-02 14:44:25
(Wait, that actually happened to Windows 95.)
Clint 2017-03-02 14:44:45
win95 had cmd.exe?