kubunto 2017-02-28 08:45:38
ertes: i take it that second one is more generic?
Tuplanolla 2017-02-28 08:45:44
The lenses `_Just` and `each` seem to work the same. Is there any reason to prefer one over the other?
ertes 2017-02-28 08:46:32
kubunto: yeah, sure… the former is equivalent to (Equation Rational String) using the latter variant
ertes 2017-02-28 08:46:51
Tuplanolla: _Just is not just a lens, but a prism
ertes 2017-02-28 08:47:00
> _Just # 5
lambdabot 2017-02-28 08:47:04
Just 5
Tuplanolla 2017-02-28 08:47:22
Ah, of course. I didn't consider that since Microlens doesn't have prisms.
ertes 2017-02-28 08:48:45
i believe 'each' isn't even a lens
ertes 2017-02-28 08:48:45
:t each
lambdabot 2017-02-28 08:48:45
(Each s t a b, Applicative f) => (a -> f b) -> s -> f t
ertes 2017-02-28 08:48:45
yeah, it's a traversal
ertes 2017-02-28 08:49:02
(neither is _Just)
mbw 2017-02-28 08:50:33
Hello everyone. I have a question regarding zipping stuff, in the sense of vector operations. I can prototype code using lists by making it highly polymorphic, using Functor, Foldable etc. However, the Prelude zip functions refer to lists. While I could use liftA2 or something, I would in general need a wrapper like ZipList. I saw that Data.Vector.Vector is an instance of MonadZip, however. Is this the way
mbw 2017-02-28 08:50:39
to go in this case? Shouldn't there be a version that only needs an Applicative constraint, instead of Monad?
mbw 2017-02-28 08:51:08
I just would like to know what the "idiomatic" solution would be.
johnw 2017-02-28 08:51:58
I'd guess that an Applicative-only zip would work for vectors
mbw 2017-02-28 08:54:55
It doesn't appear that this exists, however. But I have to admit that I only *presume* that the Applicative instance behaves like lists.
johnw 2017-02-28 08:56:06
what I mean is: liftA2 (,)
dolio 2017-02-28 08:57:26
That will probably be a cartesian product.
johnw 2017-02-28 08:57:36
mostly likely, yes, not ZipList
johnw 2017-02-28 08:57:43
for that, you'll need a ZipVector wrapper, won't you?
dolio 2017-02-28 08:57:57
You would, but you'd have to make it yourself.
shapr 2017-02-28 08:58:52
You wouldn't download a profunctor, would you?
johnw 2017-02-28 09:00:09
huh?
Sornaensis 2017-02-28 09:03:52
shapr: lol
mbw 2017-02-28 09:04:05
I just wanted to do the idiomatic thing. MonadZip probably isn't too terrible, but it's overkill, albeit for the same reasons MonadPlus is, compared to Alternative. Or Maybe in contrast to Option. This is probably very pedantic and I don't know if it's of any "real world" relevance.
johnw 2017-02-28 09:05:25
mbw: I think the "idiomatic" way is to use a type wrapper that provides the instance you need for the least typeclass that will do the job; even if you went with MonadZip, you'd still need a way to say that it's a ZipList-like variant, and not the usual zip for two vectors (for which a function of that name with that functionality already exists in Data.Vector)
pi___ 2017-02-28 09:05:44
hi is there a get.haskellstack.com mirror?
dolio 2017-02-28 09:06:54
ZipList-like variant of what?
kubunto 2017-02-28 09:06:54
ertes: tyvm for the help btw
johnw 2017-02-28 09:07:14
dolio: he wanted a zip for Vector that was akin to ZipList for lists, according to what I understood of the original request
dolio 2017-02-28 09:07:51
I thought the problem was just 'how do you abstract over zipping?'
mbw 2017-02-28 09:08:12
dolio's got it right.
johnw 2017-02-28 09:08:29
so then, isn't the simplest expression of that liftA2 (,)?
dolio 2017-02-28 09:08:45
No, because that isn't zipping.
johnw 2017-02-28 09:09:05
oh? maybe I don't understand what zipping is then
mbw 2017-02-28 09:09:16
But then I'd still have to roll my own Applicative wrapper for arrays, vectors, assuming they behave like lists by default (cartesian product).
mbw 2017-02-28 09:10:07
> (,) <$> [1..3] <*> [1..3]
lambdabot 2017-02-28 09:10:13
[(1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3)]
mbw 2017-02-28 09:10:23
> (,) <$> ZipList [1..3] <*> ZipList [1..3]
dolio 2017-02-28 09:10:24
Zipping is when you pair up values by aligning the common positions in two structures.
lambdabot 2017-02-28 09:10:29
mueval-core: Time limit exceeded
thoughtpolice 2017-02-28 09:10:31
Heads up: Hackage downtime window is about to happen.
johnw 2017-02-28 09:10:45
is liftA2 (,) a sort of "free zip" then?
Rotaerk 2017-02-28 09:10:56
zipping *should* be interleaving, because that's what real zippers actually do
thoughtpolice 2017-02-28 09:10:57
Expect a little downtime, hopefully < 20min worth (syncing a large database with many files is slow)
mbw 2017-02-28 09:12:08
> (,) <$> (ZipList [1..3]) <*> (ZipList [1..3])
lambdabot 2017-02-28 09:12:11
ZipList {getZipList = [(1,1),(2,2),(3,3)]}
dolio 2017-02-28 09:13:35
ZipList is an applicative whose operation is zipping of lists, but that doesn't mean that every Aplicative is zipping.
benzrf 2017-02-28 09:14:46
@let rotaerk'sZip = (toListOf (traverse . each) .) . zip
lambdabot 2017-02-28 09:14:49
Defined.
Rotaerk 2017-02-28 09:14:57
lol
benzrf 2017-02-28 09:15:01
> rotaerk'sZip [1, 2, 3, 4] [5, 6, 7, 8]
mbw 2017-02-28 09:15:02
Exactly, hence the abstraction via Applicative => t a -> t a -> a or something doesn't uniquely describe what I want to do. Since MonadZip does, I'll just use that for now. I wouldn't use that kind of super-polymorphic code for number crunching anyway I think.
Sornaensis 2017-02-28 09:15:04
is hackage down
johnw 2017-02-28 09:15:05
dolio: so cartesian product isn't zipping?
lambdabot 2017-02-28 09:15:07
mueval-core: Time limit exceeded
benzrf 2017-02-28 09:15:11
oops
johnw 2017-02-28 09:15:17
that makes sense
johnw 2017-02-28 09:15:31
I see the reason for the name ZipList then
dolio 2017-02-28 09:15:47
Right.
benzrf 2017-02-28 09:16:11
hmm, what the heck?
benzrf 2017-02-28 09:16:14
that worked on my end o=
mbw 2017-02-28 09:16:23
Maybe Applicatives haven't been in base long enough to mandate an abstraction that doesn't warrant a monad instance?
Tuplanolla 2017-02-28 09:16:24
> rotaerk'sZip [1, 2, 3, 4] [5, 6, 7, 8]
lambdabot 2017-02-28 09:16:28
[1,5,2,6,3,7,4,8]
Tuplanolla 2017-02-28 09:16:37
Maybe lambdabot just hates you, benzrf.
Rotaerk 2017-02-28 09:16:37
that's a proper zipper
Sornaensis 2017-02-28 09:16:45
> sum [1..]
lambdabot 2017-02-28 09:16:53
mueval: ExitFailure 1
benzrf 2017-02-28 09:17:52
i finally read-and-understood the Clowns and Jokers paper the other day
benzrf 2017-02-28 09:17:54
its nifty!
dolio 2017-02-28 09:17:55
MonadZip is around to generalize GHC's list comprehension syntax.
benzrf 2017-02-28 09:18:30
whoa, hackage down for me too Sornaensis
benzrf 2017-02-28 09:18:32
=(
mbw 2017-02-28 09:18:49
I am not misusing it, am I?
dolio 2017-02-28 09:18:55
Which, until very recently, was necessarily going to be a Monad.
thoughtpolice 2017-02-28 09:19:07
https://www.reddit.com/r/haskell/comments/5wpkhh/heads_up_short_hackage_downtime_today_30_minutes/
benzrf 2017-02-28 09:19:15
oh
mbw 2017-02-28 09:19:15
I see.
shapr 2017-02-28 09:19:17
dolio: huh?
Sornaensis 2017-02-28 09:19:18
kk
shapr 2017-02-28 09:19:41
dolio: list comp generalization is now an applicative?
Rotaerk 2017-02-28 09:19:47
> rotaerk'sZip [1, 2, 3] [4, 5, 6, 7, 8, 9]
lambdabot 2017-02-28 09:19:52
[1,4,2,5,3,6]
Rotaerk 2017-02-28 09:19:59
crap, lined up the zipper wrong
dolio 2017-02-28 09:20:28
I'm not sure if it works, but you could use Applicative for some comprehensions if ApplicativeDo were enabled.
mbw 2017-02-28 09:20:30
isn't your zip something like interleave?
Rotaerk 2017-02-28 09:20:42
that's what I'm saying; that's what a zipper actually does :P
dolio 2017-02-28 09:21:00
I'm not sure how that would interact with zipping.
mbw 2017-02-28 09:22:11
I am probably overthinking things again by trying to be "clever"
joseph07 2017-02-28 09:22:19
I'm trying to install turtle globally (stack install turtle) but I'm getting a lot of 443 errors (e. g. s3.amazonaws.com/hackage.fpcomplete.com/package/mwc-random-0.13.4.0.tar.gz) using lts-5.17. Anyone know if stackage is known to be down or something?
dolio 2017-02-28 09:22:19
shapr: For instance [x + y + z | x <- a, y <- b, z <- c] only needs Applicative.
dolio 2017-02-28 09:22:57
And [f x | x <- a] only needs functor.
shapr 2017-02-28 09:23:30
I want a blog post so I can read more detail when I'm not at work *sigh*
shapr 2017-02-28 09:23:36
but yeah, I see some of that
mbw 2017-02-28 09:23:54
This is one hell of an abstraction though, since the underlying monoid isn't unique.
Chousuke 2017-02-28 09:23:54
joseph07: might have something to do with Amazon S3 having trouble...
dolio 2017-02-28 09:24:03
You only need Monad when the bound variables appear in subsequent right hand sides.
joseph07 2017-02-28 09:25:15
Chousuke: is amazon s3 having trouble?
Ptival 2017-02-28 09:25:40
anyone familiar with unbound/unbound-generics/bound? any reason to prefer one over the others? does the latter even solve the same problem?
joseph07 2017-02-28 09:25:40
oh yup look at that
shapr 2017-02-28 09:26:43
dolio: ah, that boils it down nicely
joseph07 2017-02-28 09:26:50
looks like quora is down too.. whelp guess I might as well go home
cocreature 2017-02-28 09:28:07
great hackage is hosted on s3 …
davean 2017-02-28 09:28:22
cocreature: huh what?
dolio 2017-02-28 09:28:32
No.
davean 2017-02-28 09:28:33
no it isn't, what are you talking about?
cocreature 2017-02-28 09:28:45
davean: oh so it is down for a different reason?
davean 2017-02-28 09:28:54
cocreature: planned migration, announced even!
dolio 2017-02-28 09:28:55
It's just down for some scheduled maintenance that has been announced several times in the last 15 minutes here.
Ptival 2017-02-28 09:29:03
https://www.reddit.com/r/haskell/comments/5wpkhh/heads_up_short_hackage_downtime_today_30_minutes/
cocreature 2017-02-28 09:29:05
davean: ah ok, sry
davean 2017-02-28 09:29:15
cocreature: we're updating the base system and migrating it to a new server
nitrix 2017-02-28 09:29:27
S3 is down.
davean 2017-02-28 09:29:38
It'll be back up as soon as this acid-state DB reloads, so like 5 minutes
joseph07 2017-02-28 09:29:39
but it looks like "stackage" is hosted on s3
davean 2017-02-28 09:29:53
Its a touch ironic our planned migration is during S3 downtime
cocreature 2017-02-28 09:29:54
great
davean 2017-02-28 09:30:03
maybe we should have moved it ...
davean 2017-02-28 09:30:07
I didn't realize AWS was down
thoughtpolice 2017-02-28 09:30:15
no, this is the perfect cover
nshepperd_ 2017-02-28 09:30:17
Stackage is hosted on s3, it seems
mnoonan 2017-02-28 09:30:33
aww man, I just 'stack new'd :(
davean 2017-02-28 09:30:34
and hackage is back!
Ptival 2017-02-28 09:30:46
neat!
jackhill 2017-02-28 09:30:54
Thanks for you work, devean!
joseph07 2017-02-28 09:31:42
woot so I guess I could download the packages for stack myself from hackage
cocreature 2017-02-28 09:31:45
yep, thanks davean! (and whoever else was involved)
davean 2017-02-28 09:31:55
thoughtpolice too
jackhill 2017-02-28 09:32:09
yes, everyone else too ♥
davean 2017-02-28 09:32:11
I really need to make a high-availabiltiy version of hackage :(
thoughtpolice 2017-02-28 09:32:11
FWIW, Stackage repository mirrors are hosted on S3. But technically you should be able to use Hackage's index to resolve and download packages. Maybe not GHC bindists, tho
davean 2017-02-28 09:32:24
Ok, I did
thoughtpolice 2017-02-28 09:32:27
(I have no idea how to point it to Hackage's index but it's surely something obvious in stack.yaml, I'm guessing)
Darwin226 2017-02-28 09:32:27
how?
davean 2017-02-28 09:32:30
I need to make it available to people
cocreature 2017-02-28 09:32:52
thoughtpolice: I think it's not quite that easy. they maintain additional metadata or something like that
thoughtpolice 2017-02-28 09:33:03
Mmm. I was about to say, this might be the ticket: https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md#package-indices
cocreature 2017-02-28 09:33:13
maybe I'm wrong :)
mnoonan 2017-02-28 09:40:53
while I'm twiddling my thumbs re: s3, I have a question: I want to do some parsing of some relatively uniform C++ headers that wrap a C API in order to automatically generate analogous Haskell bindings to that C API.
mnoonan 2017-02-28 09:41:00
What are some good options for parsing C++?
mnoonan 2017-02-28 09:42:26
is LibClang the only full-featured option? (not that I require a full-featured option for this use case)
benzrf 2017-02-28 09:43:45
mnoonan: couldnt you parse the C instead?
mnoonan 2017-02-28 09:44:48
benzrf: Yeah, but the "problem" is that the C represents an older API, and it was cleaned up in various ways for the C++ API.
mnoonan 2017-02-28 09:44:49
So I'
mnoonan 2017-02-28 09:45:00
d like to make use of that cleanup, ideally.
joseph07 2017-02-28 09:45:08
wow changing the download-prefix in package-indices in stack's config.yaml actually seems to work like a charm