merijn 2017-02-27 23:46:44
bollu: If you're happy with a hacky approximation that's a bit brittle: https://gist.github.com/merijn/6130082
bollu 2017-02-27 23:47:14
merijn: hm
bollu 2017-02-27 23:47:25
merijn: I don't understand how that is equivalent to what I asked >_<
edwardk 2017-02-27 23:47:34
mniip: decorate it as need be to make it nontrivial. add a base case if you only want finite cases
bollu 2017-02-27 23:47:45
merijn: I'm trying to show that LEM <-> (not forall not a <-> exists a)
bollu 2017-02-27 23:48:13
merijn: like, I'm trying to show that adding either LEM or the (not forall not a <-> exists a) to intutionistic logic gives you the same expressive power
bollu 2017-02-27 23:48:15
am I mistaken?
bollu 2017-02-27 23:48:26
edwardk: ^ I think you would have ideas about this? :)
edwardk 2017-02-27 23:48:49
i would if i could keep my eyes open, but pain meds say otherwise =P
bollu 2017-02-27 23:48:53
xD
bollu 2017-02-27 23:48:54
OK :)
edwardk 2017-02-27 23:49:10
there is a whole ##logic channel though =)
bollu 2017-02-27 23:49:11
edwardk: I also wanted to talk to you about applicativeDo as I took it up, but perhaps some other time
bollu 2017-02-27 23:49:13
I see
edwardk 2017-02-27 23:49:42
i'm more apt to field applicativedo questions ;)
bollu 2017-02-27 23:50:00
xD
edwardk 2017-02-27 23:51:49
re your LEM thing, dolio can probably remember/decipher the connections there. i dont have all the different gradations of laws categorized in my brain about what implies what off hand
tabaqui1 2017-02-27 23:53:23
why Int is not a instance of Monoid class?
tabaqui1 2017-02-27 23:53:31
with mempty = 0, mappend = (+)
cocreature 2017-02-27 23:53:51
tabaqui1: because there are multiple valid instances, e.gg. mempty = 1, mappend = (*) would also work
cocreature 2017-02-27 23:54:02
tabaqui1: there are Sum and Product newtypes in Data.Monoid
tabaqui1 2017-02-27 23:54:12
cocreature: hm, yeah, right, thx
Aruro 2017-02-28 00:08:44
how does ghci keep completions strings? is it one big [String] ?
Aruro 2017-02-28 00:10:15
i have list of length 1885, and it should take 20k space. is it suitable for old philosophical question when the list is too long to be good? :)
Aruro 2017-02-28 00:10:44
particularly for operations like isSuffixOf
Rembane 2017-02-28 00:10:57
Aruro: What do you use the list for?
cocreature 2017-02-28 00:10:59
how often does your list change and what kind of operations do you perform on it?
Aruro 2017-02-28 00:11:02
completions
Aruro 2017-02-28 00:11:12
its static list, forefer
bot_tester 2017-02-28 00:11:42
pl \f g h x -> f (g x) (h x)
Aruro 2017-02-28 00:11:47
its [String] im running filter with isPrefixOf on it and form completions in haskeline
cocreature 2017-02-28 00:11:50
A trie seems more appropriate for completions
bot_tester 2017-02-28 00:12:43
@pl \f g h x -> f (g x) (h x)
lambdabot 2017-02-28 00:12:43
liftM2
Aruro 2017-02-28 00:12:49
emacs haskell mode is for sure slow to edit a list of strings this big :)
Aruro 2017-02-28 00:13:18
cocreature: my question is does this type of data slow down things?
cocreature 2017-02-28 00:13:57
Aruro: does calling isPrefixOf on thousands of elements slow down things? definitely!
cocreature 2017-02-28 00:14:24
but the slowdown is mostly caused by doing a linear scan over all elements and not so much by using a list instead of a vector
Aruro 2017-02-28 00:14:46
so i will not win much in switching to different data structure?
cocreature 2017-02-28 00:15:15
you will win enormously if you switch to a trie, you will probably win a bit if you switch to vector
cocreature 2017-02-28 00:15:18
so use a trie :)
Aruro 2017-02-28 00:15:22
:)
Aruro 2017-02-28 00:16:06
im using haskeline simpleCompletion function, will haskeline work well with trie?
cocreature 2017-02-28 00:16:45
sry, I've never used haskeline so I can't answer this
cocreature 2017-02-28 00:17:11
I don't see why not
Aruro 2017-02-28 00:17:19
the thing is haskeline completion module has data structures which are based on strings
Unhammer 2017-02-28 00:17:57
last time I checked, packed-dawg was the most space-efficient trie I found on hackage, while bytestring-trie was slightly faster (and lets you store values, in case you need tath)
Unhammer 2017-02-28 00:18:16
argh
Aruro 2017-02-28 00:18:31
im sorry, trie i need just for search, i can have Trie String? right?
Unhammer 2017-02-28 00:18:53
Aruro, if you're just checking membership, try packed-dawg or bytestring-trie
Unhammer 2017-02-28 00:19:21
I *think* bytestring-trie will be faster, but test it.
cocreature 2017-02-28 00:19:36
Aruro: that depends on the library you use but you can definitely put a String into a trie. it just might require that you encode it to a bytestring or something like that
Unhammer 2017-02-28 00:20:38
Aruro, import Data.Text.Encoding (decodeUtf8With, encodeUtf8)
Unhammer 2017-02-28 00:20:41
and Data.Trie.fromList (map (\s -> (encodeUtf8 s, ()))) listOfStrings
Unhammer 2017-02-28 00:20:45
something like that
Aruro 2017-02-28 00:21:19
Unhammer: cocreature: ty guys for help
Unhammer 2017-02-28 00:21:24
np
Aruro 2017-02-28 00:21:34
i will switch to trie
nak 2017-02-28 00:26:19
hello
nak 2017-02-28 00:26:49
i am looking at https://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Cont.html and i'm trying to find the implementation of >>=
nak 2017-02-28 00:26:55
but i can't seem to find it. any help?
bennofs 2017-02-28 00:29:06
nak: look at http://hackage.haskell.org/package/transformers-0.5.4.0/docs/src/Control-Monad-Trans-Cont.html#line-173
bennofs 2017-02-28 00:29:45
nak: the types for mtl are defined in the transformers package, mtl only reexports them (mtl provides the type classes like MonadCont and MonadReader etc but not the types themselves)
nak 2017-02-28 00:30:55
bennofs: a lot of that is going over my head
nak 2017-02-28 00:31:16
bennofs: i'm trying to find the >>= implementation for Cont, not ContT
bennofs 2017-02-28 00:31:32
nak: yeah but Cont r is just a type synonym for ContT r Identity
bennofs 2017-02-28 00:31:42
nak: so it's a "special" form of ContT
nak 2017-02-28 00:32:03
hmm ok maybe i have to understand what ContT is better then
nak 2017-02-28 00:32:08
do you think you can help me?
nak 2017-02-28 00:32:17
i *barely* have a partial understanding of Cont
bennofs 2017-02-28 00:32:23
nak: that code I linked is pretty unreadable though, there's lot of pragmas/ifdef
bennofs 2017-02-28 00:33:07
nak: the concept you're looking for is called monad transformers. don't know where the best resource to learn about them is though
mauke 2017-02-28 00:33:09
m >>= k = ContT $ \ c -> runContT m (\ x -> runContT (k x) c)
mauke 2017-02-28 00:33:13
you can just ignore the T's
merijn 2017-02-28 00:33:37
I always recommend the "learn monad transformers by implementing one" approach
merijn 2017-02-28 00:33:58
See here: https://gist.github.com/merijn/098106abd45c940dab09
nak 2017-02-28 00:34:09
well i'm not sure i want to learn about monad transformers to be honest
nak 2017-02-28 00:34:15
i just want to learn the basics of the continuation monad
nak 2017-02-28 00:34:29
like this
nak 2017-02-28 00:34:31
runCont (calculateLength "123" >>= double) print
bennofs 2017-02-28 00:34:36
nak: oh, then there's probably better places to find the definition of >>= for Cont other than the mtl package
nak 2017-02-28 00:34:45
there calculateLength and double each have a continuation parameter
nak 2017-02-28 00:35:14
i learn things well by learning how they're implemented
nak 2017-02-28 00:35:29
maybe this is a stupid question:
bennofs 2017-02-28 00:35:31
nak: the code is equavilent to: s >>= f = Cont $ \c -> runCont s $ \x -> runCont (f x) c for 'Cont'
nak 2017-02-28 00:35:34
does Cont have fmap ?
bennofs 2017-02-28 00:35:41
nak: yes
mauke 2017-02-28 00:36:47
:t \m k -> cont $ \ c -> runCont m (\ x -> runCont (k x) c)
lambdabot 2017-02-28 00:36:49
Cont r t -> (t -> Cont r a) -> Cont r a
Reisen 2017-02-28 00:37:37
Is it possible to use a typeclass to resolve a method based purely on the type chosen, even if that method doesn't use it in its type signature?
Reisen 2017-02-28 00:37:43
Attempts: http://lpaste.net/2147505651117457408
Reisen 2017-02-28 00:37:58
I.E, I'd like to be able to write x = multiply 3 :: MultiplyBy 5
nak 2017-02-28 00:38:21
so when we're looking at ContT r m
Reisen 2017-02-28 00:38:26
Where the 5 selects the typeclass, but it's ambiguous, and of course the type family was my attempt to get the class variable into the method somehow but injectivity stops that working
nak 2017-02-28 00:38:36
so when we're looking at ContT r m, what exactly is r and m? how can i reason about them
mauke 2017-02-28 00:38:51
Reisen: needs more explicit type application
Reisen 2017-02-28 00:39:15
mauke, how do you mean?
mauke 2017-02-28 00:39:40
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#visible-type-application
Reisen 2017-02-28 00:40:04
mauke, well I mean, I could write that as `multiply @5 3` sure but
Reisen 2017-02-28 00:40:10
Isn't the problem that I can't write this without ambiguoustypes?
bennofs 2017-02-28 00:40:31
Reisen: I think multiply @5 3 should work
Reisen 2017-02-28 00:40:41
bennofs, but I get errors at compile time even before I try and use the function
bennofs 2017-02-28 00:41:11
Reisen: do you get those errors with -XTypeApplications as well?
mauke 2017-02-28 00:41:21
nak: r is the continuation return type. m is the base monad (the one we're transforming)
bennofs 2017-02-28 00:41:27
Reisen: i believe that extension also extends the ambigouousness check
Reisen 2017-02-28 00:41:41
bennofs, yes
bennofs 2017-02-28 00:43:30
Reisen: hmm, seems you need -XAllowAmbiguousTypes as well
bennofs 2017-02-28 00:43:40
Reisen: also -XFlexibleInstances
Reisen 2017-02-28 00:43:43
Yeah, but I kind of was hoping there might be a way of avoiding that
bennofs 2017-02-28 00:43:45
Reisen: after that, it works
Reisen 2017-02-28 00:43:46
FlexibleInstances is in my paste
bennofs 2017-02-28 00:44:03
Reisen: oh only in the second one, i used the first one
Reisen 2017-02-28 00:44:05
But AmbiguousTypes is... I feel like I'm doing something really wrong when I use that extension
bennofs 2017-02-28 00:44:47
Reisen: well, your type really is ambiguous. You need to explictly specify the type when using it, so that's ambiguous. If you want that, use the extension, I think that's what it is made for
Reisen 2017-02-28 00:45:22
Perhaps there's another way to get a similar behaviour, essentially my goal is to write a function that you can use to choose a formatter with something like
Reisen 2017-02-28 00:45:37
output = format :: As "html"
Reisen 2017-02-28 00:45:47
So that I can use DataKinds to select the instance with a type level string
bennofs 2017-02-28 00:46:12
Reisen: how about: format @"html" ?
Reisen 2017-02-28 00:46:31
It's the same problem though, the ambiguous type doesn't really give me a way to write the method without an error
Reisen 2017-02-28 00:46:38
Because It's `format :: Text -> Text`
bennofs 2017-02-28 00:47:02
Reisen: well, but with -XAmbiguousTypes, you could make it work as format @"html" :: Text -> Text
Reisen 2017-02-28 00:47:19
Yeah, I guess I have no choice but to use AmbiguousTypes for this then
Reisen 2017-02-28 00:47:27
Dang
mauke 2017-02-28 00:49:14
format (Proxy :: Proxy "html")
mauke 2017-02-28 00:49:34
formatHTML
rgc 2017-02-28 01:01:04
hi
rgc 2017-02-28 01:01:42
I don't understand this one : foldr (/) 1 [12,2,3] = 18.0
rgc 2017-02-28 01:02:05
it seems like 12*3/2
brynser 2017-02-28 01:02:46
> (12 / (2 / (3 / 1)))
rgc 2017-02-28 01:02:48
as in foldr (/) 1 [12,2,24] = 144.0
lambdabot 2017-02-28 01:02:49
18.0
brynser 2017-02-28 01:02:55
I think
mauke 2017-02-28 01:02:59
> foldr (/) 1 [12,2,3] :: Expr
lambdabot 2017-02-28 01:03:03
12 / (2 / (3 / 1))
brynser 2017-02-28 01:03:19
Neat
rgc 2017-02-28 01:04:02
brynser: can't get it :)
mauke 2017-02-28 01:05:09
> foldr f z [a,b,c] :: Expr
lambdabot 2017-02-28 01:05:15
f a (f b (f c z))
rgc 2017-02-28 01:06:38
12/2=6 ; 6/3=2
brynser 2017-02-28 01:06:41
rgc: I'm not great at it myself. There's a thorough chapter in the haskellbook.com book if you have that, or maybe this https://wiki.haskell.org/Fold
rgc 2017-02-28 01:06:43
confused :)
rgc 2017-02-28 01:07:26
as in foldr (/) 1 [12,2,24] = 144.0
rgc 2017-02-28 01:07:56
12*24=228
rgc 2017-02-28 01:08:06
228/2=144
rgc 2017-02-28 01:08:14
why the *?
mauke 2017-02-28 01:08:17
rgc: do you understand 12 / (2 / (3 / 1))?
rgc 2017-02-28 01:08:57
ops
rgc 2017-02-28 01:09:05
mauke: can see it now :9
rgc 2017-02-28 01:09:08
thank's
rgc 2017-02-28 01:09:12
:)
wz1000 2017-02-28 01:15:41
So Haskell isn't in GSOC this year too. Are there plans for a Summer of Haskell?
fendor 2017-02-28 01:21:33
there is a summer of haskell? :O
tdammers 2017-02-28 01:22:27
not sure if it's going to be a permanent thing, but last year Haskell didn't make it into Google's SoC, so people set up a Summer Of Haskell
fendor 2017-02-28 01:25:23
oh cool, i want a summer of haskell!