Search Haskell Channel Logs

Monday, February 20, 2017

#haskell channel featuring JuanDaugherty, t4nk492, spaceshi1s, glguy, Benzi-Junior, Squarism, and 8 others.

glguy 2017-02-20 05:46:34
> let m = Map.fromList [(LT, (False, Map.fromList [(1, 'a'), (2, 'b')])), (EQ, (True, Map.empty)), (GT, (False, Map.fromList [(3, 'c'), (4, 'd')]))] in (traverse . _2 . at 3) (\old -> ([old], Nothing)) m
lambdabot 2017-02-20 05:46:37
([Nothing,Nothing,Just 'c'],fromList [(LT,(False,fromList [(1,'a'),(2,'b')])...
glguy 2017-02-20 05:47:19
(traverse . _2 . at 3) (\old -> (First old, Nothing)) L.m
glguy 2017-02-20 05:47:20
> (traverse . _2 . at 3) (\old -> (First old, Nothing)) L.m
lambdabot 2017-02-20 05:47:25
(First {getFirst = Just 'c'},fromList [(LT,(False,fromList [(1,'a'),(2,'b')]...
Tuplanolla 2017-02-20 05:48:30
Very nice, glguy. I was kind of expecting `First` to pop up.
Tuplanolla 2017-02-20 05:49:08
It's surprising to see no operator like `preview` there.
glguy 2017-02-20 05:49:25
:t preview
lambdabot 2017-02-20 05:49:28
MonadReader s m => Getting (First a) s a -> m (Maybe a)
glguy 2017-02-20 05:49:38
The preview is "inlined" via the use of First
pikajude 2017-02-20 05:49:47
why doesn't the `highlighter` package exist in any stack build plan?
pikajude 2017-02-20 05:49:49
it's clearly on hackage
pikajude 2017-02-20 05:49:52
what do I do in this scenario?
glguy 2017-02-20 05:50:06
add it to your extra-deps
Tuplanolla 2017-02-20 05:50:08
What did you change when inlining it, glguy?
merijn 2017-02-20 05:50:11
pikajude: Because stack uses stackage and not everything on hackage is on stackage?
pikajude 2017-02-20 05:50:26
oh, ok
pikajude 2017-02-20 05:50:28
i didn't know that
glguy 2017-02-20 05:50:43
Tuplanolla: It's inlined into the merged operation that both previews your result and removes that key from the maps
Tuplanolla 2017-02-20 05:50:52
Let me meditate over this for a while.
glguy 2017-02-20 05:51:30
Tuplanolla: While medatating consider that preview typically works with Const, and set works with Identity
glguy 2017-02-20 05:51:46
Here those two are smashed together into (,)
quchen 2017-02-20 05:52:07
pikajude: Stack has only Stackage in scope by default; anything not in stackage you have to add to the extra dependencies. You can use »stack solver« to do this for you, see »stack solver --help«.
pikajude 2017-02-20 05:52:22
thanks everyone
pikajude 2017-02-20 05:52:23
that fixed it
pikajude 2017-02-20 05:52:32
why are packages on hackage not on stackage
pikajude 2017-02-20 05:52:36
are they manually curated
Tuplanolla 2017-02-20 05:52:40
Would it make sense to isolate the idea into a `preset`, glguy?
quchen 2017-02-20 05:53:08
pikajude: Yes, Stackage is a vetted set of packages that are all buildable together, giving a guaranteed-to-be-working subset of Hackage.
glguy 2017-02-20 05:53:19
Tuplanolla: possibly locally, but I don't think it needs to be in the lens package. There are lots of combinations like this
pikajude 2017-02-20 05:53:21
oh ok
quchen 2017-02-20 05:53:25
Upside: works, downside: deviating from the vetted set can be tricky.
Tuplanolla 2017-02-20 05:53:34
Locally indeed. Let's see what happens.
Tuplanolla 2017-02-20 05:58:53
Certainly you mean `First` instead of `Const`, glguy.
glguy 2017-02-20 05:59:00
no
glguy 2017-02-20 05:59:24
I'm talking about the choice of types providing Applicative instances
lambdamu 2017-02-20 05:59:43
Are there any interesting instances for a Group type class apart from the obvious numerical ones?
nitrix 2017-02-20 06:02:48
I have a curious question. An email thread at work meant to be helpful about a disctinction between "Composition vs. Inheritance" https://www.thoughtworks.com/insights/blog/composition-vs-inheritance-how-choose , yet I can't help but think that Inheritance is a form of composition (at least at the type level).
merijn 2017-02-20 06:04:00
nitrix: In what way?
nitrix 2017-02-20 06:04:12
I'm not that great with CT, but if your objects are type classes and morphisms are dependencies between them, isn't (.) essentially inheritance?
t4nk492 2017-02-20 06:04:21
Hello, friends! Why this fails? let {listGen (x@(a:b):_) = x} in listGen [1,2,3,4]
t4nk492 2017-02-20 06:04:43
can you not extract two numbers this way?
glguy 2017-02-20 06:05:06
t4nk492: You've parenthesized it incorrectly
glguy 2017-02-20 06:05:39
(a:b) is a whole list where a is an element and b is a list
glguy 2017-02-20 06:06:06
[1,2,3,4] is (1:(2:(3:(4:[]))))
t4nk492 2017-02-20 06:06:45
hmm, I see
t4nk492 2017-02-20 06:07:17
Thank you!
Benzi-Junior 2017-02-20 06:08:24
hey I'm trying to generate tags for a library that uses a header file and the ghci parser always fails when it comes to the #include line
glguy 2017-02-20 06:08:43
Benzi-Junior: Did you add {-# Language CPP #-} to the top of the file?
glguy 2017-02-20 06:08:52
Oh, #include usually happens in .hsc
glguy 2017-02-20 06:08:53
not .hs files
Squarism 2017-02-20 06:09:27
Looking at package Data.Time here. Cannot find some clear candidate for a type carrying "unix-timestamp" / seconds-or-millis since 1970...
Benzi-Junior 2017-02-20 06:09:33
glguy, yes its in there
Squarism 2017-02-20 06:09:42
anyone know a such
glguy 2017-02-20 06:09:53
Benzi-Junior: If you're trying to load a .hsc file, you'll need to process it with hsc2hs first
quchen 2017-02-20 06:10:10
Squarism: https://hackage.haskell.org/package/time-1.8/docs/Data-Time-Clock-POSIX.html
glguy 2017-02-20 06:10:17
otherwise it might help to paste the code and error message
Benzi-Junior 2017-02-20 06:10:24
cabal was able to build the package
quchen 2017-02-20 06:10:26
Squarism: POSIXTime is »Unix time« here.
Squarism 2017-02-20 06:10:36
ah ok
Benzi-Junior 2017-02-20 06:10:39
so this appears to be something specific to ghci
Benzi-Junior 2017-02-20 06:11:19
glguy, the code is the vector library on hackage
glguy 2017-02-20 06:12:39
Benzi-Junior: You can open vector package in GHCi with "cabal repl"
Benzi-Junior 2017-02-20 06:13:24
glguy, ah
Benzi-Junior 2017-02-20 06:16:06
glguy, ok sweet that works
Tuplanolla 2017-02-20 06:18:18
@let presetBad l = asks (first getFirst . l (\ x -> (First x, Nothing))) -- I can define it like this, but this doesn't quite match the way `preview` is defined, glguy.
lambdabot 2017-02-20 06:18:20
Defined.
Tuplanolla 2017-02-20 06:18:42
There's no `foldMapOf` there.
glguy 2017-02-20 06:19:35
That means you haven't meditated enough on the idea that Const + Identity = (,)
nitrix 2017-02-20 06:22:02
edwardk: This is just a thought experiment, but is it remotely possible to have a category whose objects are type classes and morphisms, dependencies between them? If so, does composition becomes inheritence?
spaceshi1s 2017-02-20 06:39:04
any recommendations on a library to use for manipulating polynomials?
JuanDaugherty 2017-02-20 06:39:49
any basic alg?
JuanDaugherty 2017-02-20 06:40:25
or just hs
spaceshi1s 2017-02-20 06:42:15
we need expansion - i hope thats what it's called. for instance translating (x+y)(x+y) into x^2 + 2xy + y^2
ffilozov 2017-02-20 06:44:04
How do I report a broken link on haskell.org?