Search Haskell Channel Logs

Thursday, February 2, 2017

#haskell channel featuring wayne, erisco, geekosaur, handicraftsman, tsahyt, glguy, and 6 others.

wayne 2017-02-02 09:45:14
flip and fold with $?
wayne 2017-02-02 09:45:26
is there a lazier way?
ertes 2017-02-02 09:45:41
:t foldl (.) id
lambdabot 2017-02-02 09:45:44
Foldable t => t (c -> c) -> c -> c
wayne 2017-02-02 09:46:12
wouldn't that evaluate the last function first though?
wayne 2017-02-02 09:46:23
i want the first function to be evaluated first
wayne 2017-02-02 09:46:37
and maybe we'll have many many functions
ertes 2017-02-02 09:46:38
:t foldr (flip (.)) id
lambdabot 2017-02-02 09:46:40
Foldable t => t (c -> c) -> c -> c
tsahyt 2017-02-02 09:47:02
ertes: what's the title of this paper?
ertes 2017-02-02 09:47:31
> foldr (flip (.)) id (const 'y' : repeat id) 'x'
wayne 2017-02-02 09:47:39
oh you're right. that's exactly what foldr is for
lambdabot 2017-02-02 09:47:42
mueval: ExitFailure 1
wayne 2017-02-02 09:47:48
gosh i don't really use that one too much
geekosaur 2017-02-02 09:48:10
> foldr (.) id [f, g, h] a :: Expr
lambdabot 2017-02-02 09:48:13
f (g (h a))
ertes 2017-02-02 09:48:20
ah, of course
wayne 2017-02-02 09:48:51
yeah i think i still may have to flip the list before
wayne 2017-02-02 09:48:55
reverse, that is
wayne 2017-02-02 09:49:03
but i wonder if there's a lazier way
geekosaur 2017-02-02 09:49:16
> foldr (flip (.)) id [f, g, h] a :: Expr
lambdabot 2017-02-02 09:49:19
h (g (f a))
ertes 2017-02-02 09:49:30
> foldr (.) id (const 'y' : repeat id) 'x'
lambdabot 2017-02-02 09:49:33
'y'
ertes 2017-02-02 09:49:59
wayne: you should first specify how you want to apply the functions
jarlg 2017-02-02 09:50:29
How do I debug the linker failing when building with cabal? I'm getting a lot of undefined references.
geekosaur 2017-02-02 09:52:49
jarlg, it requires some experience with decoding ghc-generated symbols, and generally recognizing where stuff comes from
ertes 2017-02-02 09:53:42
wayne: apply [f,g,h] x = _fillThisIn
geekosaur 2017-02-02 09:53:48
a common error is forgetting to list a module in a library, or forgetting to add that module to other-modules: if it's not exposed
erisco 2017-02-02 09:54:12
is there any tool to help find source for class instances?
wayne 2017-02-02 09:55:03
ertes: thanks, that's a helpful tip that would've made it easier to come up with the solution
wayne 2017-02-02 09:55:16
i imagine that approach comes in handy with a lot of other high order functions
ertes 2017-02-02 09:55:39
tsahyt: i forgot, sorry
ertes 2017-02-02 09:55:58
tsahyt: but it's probably one of the links in the introduction here: https://wiki.haskell.org/Yampa
erisco 2017-02-02 09:56:08
I really want to know how Sing Nat implements TestEquality
recursion-ninja 2017-02-02 09:56:24
ertes: It seems that the FFI call is in fact causing the segfault. When I comment out the call, there is no segfault. When I uncomment the FFI call, it segfaults. I had to add some NFData instances to make sure things were being forced appropriately but now I'm condfident that the FFI call is causing the segfault.
erisco 2017-02-02 09:56:29
I have looked through the sources and just cannot find it
ertes 2017-02-02 09:56:34
erisco: :i in GHCi tells you where the instance came from
tsahyt 2017-02-02 09:57:14
ertes: I'll go look for it. thanks!
jarlg 2017-02-02 09:57:18
geekosaur: Thanks, I wasn't exposing all my modules. One could imagine cabal suggesting those common errors -- do you know if people are working on such improvements? Maybe an opportunity to dive in myself.
erisco 2017-02-02 09:58:07
ertes, what is the syntax?
geekosaur 2017-02-02 09:58:23
the problem is that one is hard to diagnose, since it has no way to tell the difference between a module that is used solely during build and one that needs to be available later when the library is linked, without figuring out some way to actually use the library
erisco 2017-02-02 09:58:25
:i testEquality :: Sing Nat -> Sing Nat -> Maybe (Nat :~: Nat) fails parse at :: so it doesn't seem to accept expressions
ertes 2017-02-02 09:58:45
:i Maybe
ertes 2017-02-02 09:58:49
instance Monad Maybe -- Defined in 'GHC.Base'
erisco 2017-02-02 09:59:21
oh it dumps them all, okay
geekosaur 2017-02-02 09:59:24
and there are things that could be done on windows, or things that could be done on linux, or things that could be done on os x --- none of which would reliably work on the others (linkers are hard)
ertes 2017-02-02 09:59:55
erisco: if you use it in haskell-mode's embedded GHCi you can at least search =)
erisco 2017-02-02 10:00:01
instance forall k (k1 :: k) k2. Data.Singletons.Decide.SDecide k2 => TestEquality Sing -- Defined in `Data.Singletons.Decide'
erisco 2017-02-02 10:00:26
thank-you, this is a big help
jarlg 2017-02-02 10:01:02
geekosaur: Alright, I appreciate the insight. Have a good !
ertes 2017-02-02 10:02:11
tsahyt: FWIW i learned it by implementing it myself (which eventually became the first version of netwire)
erisco 2017-02-02 10:08:55
ah, so singletons has a type called Decision which is similar to TestEquality
erisco 2017-02-02 10:09:13
I mean similar to :~:
erisco 2017-02-02 10:09:30
the instance just maps one to the other
erisco 2017-02-02 10:09:49
so I suppose I can just simplify and stay within singletons... were you aware of this glguy?
glguy 2017-02-02 10:11:16
no, I don't know much about the singletons package beyond cracking it open to help #haskell questions :) I'll look up Decision
erisco 2017-02-02 10:16:22
https://hackage.haskell.org/package/singletons-2.2/docs/Data-Singletons-Decide.html#t:Decision
glguy 2017-02-02 10:24:56
erisco: Cool, and you even get the proof of False, so it's nicer than the Maybe (a :~: b) from yesterday
handicraftsman 2017-02-02 10:32:44
#IsAwesome
sharon_so 2017-02-02 10:37:52
Hi, I developed an app and i'd like to test its stability, from the OS, so i am thinking of tests like 'sigterm', process restart...etc, any suggestions on where i can get a list of test cases that would cover these 'stability' kind of tests ?
ph88 2017-02-02 10:44:43
hi