littleBoss 2017-02-20 07:53:20
Hi
orizzonte 2017-02-20 07:53:51
ciao
orizzonte 2017-02-20 07:54:04
!list
Akii 2017-02-20 08:01:17
johnw: this does _exactly_ what I had in mind, thanks again http://lpaste.net/352783
johnw 2017-02-20 08:01:39
great!
johnw 2017-02-20 08:02:28
you shouldn't need the first two extensions anymore
Akii 2017-02-20 08:02:47
the second one is to satisfy stylish-haskell
Akii 2017-02-20 08:02:52
but the first one definitely not
Akii 2017-02-20 08:03:01
(also this is just playground, gonna move that now xD)
Akii 2017-02-20 08:04:33
I so much love this line http://lpaste.net/352783#line36
Akii 2017-02-20 08:04:55
like the statement, not the line xD
Akii 2017-02-20 08:06:17
event sourcing in 36 lines
johnw 2017-02-20 08:06:24
st' <- maybe (appInit agg) (aggApply agg) st ev
Akii 2017-02-20 08:06:34
not a single day goes by where Haskell does not surprise me
Akii 2017-02-20 08:06:53
and there is always room for improvement xD
johnw 2017-02-20 08:07:01
we love to golf code here
Akii 2017-02-20 08:08:41
let me process that wow
Akii 2017-02-20 08:09:07
wow
Akii 2017-02-20 08:09:57
I can already see the next improvement: something with Applicative lifting
Akii 2017-02-20 08:11:00
as far as readability goes, I think this is pretty good
johnw 2017-02-20 08:11:47
as long as you're happy with it :)
Akii 2017-02-20 08:12:02
working on this for a year now, at least
Tuplanolla 2017-02-20 08:16:28
I just noticed that `uncurry (set (at i)) . preset (at i) = id`, so that's a good guideline for ordering the tuple.
jpthing 2017-02-20 08:21:44
so a tuple is like a set?
ski 2017-02-20 08:21:51
no
ski 2017-02-20 08:22:27
a (sub)set can have arbitrarily many elements, which are given without order, and without counting multiplicity
ski 2017-02-20 08:23:04
a tuple is always an `n'-tuple, for some `n', so a fixed number (`n') of components, given in order (and multiplicity, if you want to think of it like that)
ski 2017-02-20 08:23:34
in a subset, all the elements must come from the same ambient superset ("universe"/"domain of discourse")
jpthing 2017-02-20 08:23:53
It is just that Tuplanolla's form looks like the transform from a set to a sequence without recursive types.
ski 2017-02-20 08:23:59
in a tuple, each position/component has its own associated type, from which the component at that position must come
jle` 2017-02-20 08:24:18
jpthing: er, where is the set in what Tuplanolla wrote?
Tuplanolla 2017-02-20 08:24:33
That remark relates to some earlier lens polishing, jpthing.
jle` 2017-02-20 08:25:00
jpthing: are you talking about the 'set' function, which means "make it this value" ?
Tuplanolla 2017-02-20 08:25:17
Sets aren't really involved at all, jpthing.
jle` 2017-02-20 08:25:47
maybe jpthing saw the word 'set' and thought it was referring to sets in set theory
jle` 2017-02-20 08:26:23
instead of '2. to put or bring into a specified state'
jle` 2017-02-20 08:26:29
https://www.google.com/search?q=define+set
jpthing 2017-02-20 08:27:14
No they are not. I find sequences are a better match for how computers work. Even in so called set related definitions like SQL order is important to achieve performance. So It would have been better to define it as a relation of sequences.
jle` 2017-02-20 08:28:15
what is that in response to?
ski 2017-02-20 08:28:28
jpthing : but that precludes useful optimizations ..
ski 2017-02-20 08:28:49
(and makes it harder to reason about, declaratively)
jpthing 2017-02-20 08:28:53
In Haskell list can only have one type and a tuple many types but only a fixed length. I find this a fiddly restriction to work around so I am somewhat interested in lenses.
ski 2017-02-20 08:29:27
however .. with dependent types, you could get more general
jle` 2017-02-20 08:29:42
in what way do you need to work around this?
Tuplanolla 2017-02-20 08:30:27
Lenses don't give you heterogeneous lists, jpthing. They only get you tools for working with existing things as if they were.
ski 2017-02-20 08:30:27
e.g. you could easily have a sequence of `Maybe' trees, where each tree (if present) would be a perfectly balanced binary tree with `2^n' elements, `n' being the index of the `Maybe' tree in the sequence
ski 2017-02-20 08:31:53
(Okasaki had a datastructure like that in PFDS, though not using dependent types to ensure the sizing being related to the index)
ski 2017-02-20 08:32:01
@where PFDS
lambdabot 2017-02-20 08:32:01
http://www.amazon.com/Purely-Functional-Structures-Chris-Okasaki/dp/0521663504
jpthing 2017-02-20 08:32:28
thx
ski 2017-02-20 08:33:48
the `Just's/`Nothing's in the sequence would spell out a binary numeral, and e.g. merging of two such sequences into one would correspond to addition of binary numerals
jpthing 2017-02-20 08:34:20
Yes a tree should work. And has a decent efficiency model. Even if a pure data structure.
ski 2017-02-20 08:36:25
jpthing : "I find sequences are a better match for how computers work." -- if you by this refer to how in Zermelo-Fränckel set theory, they build everything (including tuples and functions) out of sets, only having such sets as elements .. then i'm sympathetic to preferring structures with more "stricture" (like tuples, trees, &c.) over (sub)set ..
ski 2017-02-20 08:36:52
jpthing : .. but, for particular purposes, like relations (SQL), sets have their place
ski 2017-02-20 08:38:02
(if anything, i don't like SQL because it doesn't fit well enough with the relational model theory. e.g. the order of attributes sometimes making a difference)
Benzi-Junior 2017-02-20 08:39:07
ok I think I'm going mad here
Benzi-Junior 2017-02-20 08:39:52
does there anywhere exist an implementation of basicUnsafeIndexM in the vector library ?
Benzi-Junior 2017-02-20 08:42:08
I'm trying to find where the inefficiency of indexing is coming from and have traced it all back to basicUnsafeIndexM which is declared and always implemented in terms of basicUnsafeIndexM (presumably from another module) but it seems not end on a concrete case
Benzi-Junior 2017-02-20 08:42:15
except for bool