<    June 2018     >
Su Mo Tu We Th Fr Sa  
                1  2  
 3  4  5  6  7  8  9  
10 11 12 13 14 15 16  
17 18 19 _2_0 21 22 23  
24 25 26 27 28 29 30
00:00 <hpc> jackdk: below the class definition, and below the type definition
00:01 boccato joined
00:04 <jackdk> I see them for normal type declarations but not for associated types, though (in the `-XTypeFamilies` sense)
00:04 sytherax joined
00:05 <hpc> type families are in the same world as type aliases
00:05 conal_ joined
00:05 <hpc> they disappear instead of being something you can think of as their own type
00:06 Igloo joined
00:09 oisdk joined
00:10 youtmon joined
00:12 ammazza joined
00:12 <* hackage> yarn2nix 0.7.0 - Convert yarn.lock files to nix expressions http://hackage.haskell.org/package/yarn2nix-0.7.0 (Profpatsch)
00:13 <Np-Harda`> Whenever I am drunk I am so much better in programming
00:13 <Np-Harda`> not like a little bit better, but 500% at least
00:14 boccato joined
00:14 <Np-Harda`> anyone else feeling that way?
00:15 progfun joined
00:18 jmcarthur joined
00:20 <geekosaur> ob https://xkcd.com/323/
00:20 <geekosaur> of course, yours is how you get the failure mode mentioned :p
00:21 oisdk joined
00:25 plutoniix joined
00:26 <maerwald> seems intero-neovim is utterly broken without stack
00:26 fishythefish joined
00:26 troydm joined
00:28 ru0mad joined
00:28 <sm> intero requires stack, no ?
00:29 <geekosaur> which is why dante exists https://github.com/jyp/dante
00:29 skeuomorf joined
00:29 <maerwald> sm: it's supposed to work with a custom backend too
00:29 <maerwald> https://github.com/parsonsmatt/intero-neovim#using-a-custom-backend
00:29 Gurkenglas joined
00:30 andyhuzhill joined
00:30 conal_ joined
00:32 obi_jan_kenobi_ joined
00:36 boccato joined
00:38 mnoonan joined
00:40 plugin joined
00:44 ozataman joined
00:46 cosmia joined
00:46 danso joined
00:47 pranz3 joined
00:48 pfurla joined
00:51 dfeuer joined
00:53 WhatisRT joined
00:53 xcmw joined
00:56 blender joined
00:56 Linter joined
00:57 cosmia joined
00:58 raynold joined
00:59 oilerspoiler[m] left
00:59 dfeuer joined
01:01 pranz4 joined
01:03 shannow_ joined
01:05 initiumdoeslinux joined
01:05 carlomazzaferro joined
01:07 diskie joined
01:10 beauby joined
01:11 pranz4 joined
01:12 pranz joined
01:13 connrs joined
01:13 nighty- joined
01:15 duoi joined
01:15 mud joined
01:19 mcspud joined
01:19 mkoenig joined
01:22 <dmwit> jackdk: Perhaps those documents were created with an older haddock, which didn't yet support type families. (It's a relatively new haddock feature.)
01:22 crobbins joined
01:23 crobbins joined
01:23 sytherax joined
01:25 enterprisey joined
01:27 djtyml joined
01:28 frankyxhl[m] joined
01:29 mnoonan joined
01:30 saurabhnanda joined
01:34 niklasl joined
01:34 jedws joined
01:39 zearen joined
01:39 fujiy joined
01:42 dodong joined
01:45 Scip joined
01:49 skeuomorf joined
01:53 thiross joined
01:53 sytherax joined
01:53 Linter joined
01:53 dogweather joined
01:55 Jesin joined
01:56 Kundry_Wag joined
01:57 cjreynolds joined
01:59 goolord[m] joined
02:00 hucksy_ joined
02:03 eschnett joined
02:06 t60r joined
02:07 whaletechno joined
02:07 sytherax joined
02:07 dogweather joined
02:08 shannow_ joined
02:08 sobol joined
02:10 xcmw joined
02:11 MP2E joined
02:12 enzo-hauss joined
02:12 theDon joined
02:17 andreabedini joined
02:18 Kundry_Wag joined
02:18 MoarSpaceFi joined
02:18 banc joined
02:19 lortabac_ joined
02:19 obi_jan_kenobi__ joined
02:22 plugin joined
02:25 dogweather joined
02:27 blender joined
02:28 daniel-s joined
02:29 cybai joined
02:29 sword865 joined
02:34 progfun joined
02:36 <* hackage> espial 0.0.2 - Espial is an open-source, web-based bookmarking server. http://hackage.haskell.org/package/espial-0.0.2 (jonschoning)
02:37 lagothrix joined
02:37 dogweather joined
02:38 chao-tic joined
02:38 sword865 joined
02:38 caw________ joined
02:38 cstrahan_ joined
02:41 progfun joined
02:42 winter joined
02:42 plugin joined
02:42 lambda-11235 joined
02:45 nesqi joined
02:45 alx741 joined
02:45 crobbins joined
02:46 progfun joined
02:46 mizu_no_oto joined
02:49 dogweather joined
02:49 vurtz joined
02:50 gregberns joined
02:50 pfurla joined
02:53 hphuoc25 joined
02:53 progfun joined
02:57 woodson joined
02:58 AetherWind joined
02:58 iAmDecim joined
02:58 TipsyMe joined
02:59 alx741 joined
03:00 unyu joined
03:03 plugin joined
03:04 edmundnoble joined
03:04 progfun joined
03:05 loc joined
03:05 fbauckho joined
03:07 ingenthr joined
03:08 fujiy joined
03:09 sunhay joined
03:11 saurabhnanda joined
03:11 kmurphy4 joined
03:13 nckx joined
03:14 sielicki left
03:15 language_agnosti joined
03:15 harfangk joined
03:16 plugin joined
03:18 replay joined
03:19 progfun_ joined
03:20 concaveirc joined
03:22 conal_ joined
03:22 otto_s_ joined
03:25 vmandela joined
03:25 lastmanstanding joined
03:30 Linter joined
03:32 dented42 joined
03:33 ingenthr joined
03:36 _vaibhavingale_ joined
03:36 ian_andrich joined
03:37 lassulus_ joined
03:37 sytherax joined
03:37 dogweather joined
03:43 andreabedini joined
03:44 iAmDecim joined
03:45 ingenthr joined
03:45 iAmDecim joined
03:45 progfun joined
03:46 mizu_no_oto joined
03:50 conal_ joined
03:51 iAmDecim joined
03:54 plugin joined
03:55 jedws joined
03:57 sytherax joined
03:59 iAmDecim joined
03:59 simukis joined
03:59 plugin joined
04:01 <* hackage> exitcode 0.1.0.1 - Monad transformer for exit codes http://hackage.haskell.org/package/exitcode-0.1.0.1 (qfpl)
04:02 Foritus joined
04:02 blender joined
04:02 hphuoc25 joined
04:03 <* hackage> odpic-raw 0.2.1 - Oracle Database Bindings http://hackage.haskell.org/package/odpic-raw-0.2.1 (leptonyu)
04:03 Linter joined
04:07 DistroTube joined
04:07 fmixing joined
04:08 yuuki_ joined
04:09 fmixing joined
04:09 pranz1 joined
04:11 codesoup joined
04:15 kefin_ joined
04:15 mac10688 joined
04:15 gregberns joined
04:17 daniel-s joined
04:17 AetherWind joined
04:18 krone_ joined
04:20 monochrom joined
04:25 johnvonneumann joined
04:36 hphuoc25 joined
04:37 saurabhnanda joined
04:38 metalbot joined
04:39 saurabhn_ joined
04:41 conal_ joined
04:42 gregberns joined
04:42 Unhammer joined
04:43 iAmDecim joined
04:43 conal_ joined
04:45 cybai joined
04:46 djtyml joined
04:46 louispan joined
04:47 <* hackage> reroute 0.5.0.0, Spock 0.13.0.0, Spock-core 0.13.0.0, Spock-api-server 0.12.0.1, Spock-api 0.12.0.1, Spock-api-ghcjs 0.12.0.1 (AlexanderThiemann): https://qbin.io/miami-rj-dooj
04:49 boj joined
04:49 andromeda-galaxy joined
04:51 achirkin joined
04:53 znack joined
04:53 nshepper1 joined
04:54 iAmDecim joined
04:57 robstr joined
04:57 language_agnosti joined
05:01 oisdk joined
05:05 takuan joined
05:05 danso joined
05:07 achirkin joined
05:09 sheyll joined
05:10 slomo joined
05:12 davr0s joined
05:13 language_agnosti joined
05:14 andreabedini joined
05:15 dogweather joined
05:16 xtreak joined
05:16 plugin joined
05:17 gregberns joined
05:18 hjdskes joined
05:18 UnChallengeD joined
05:20 <pounce> can I use the type annotation :: for things that aren't functions?
05:20 ozzymcduff joined
05:20 <geekosaur> > 5 :: Int
05:20 <lambdabot> 5
05:20 <geekosaur> although that question is a bit unclear: use where?
05:21 gregberns joined
05:22 <pounce> something like `primes :: [Int]; primes = ...`
05:22 <geekosaur> sure
05:22 ammazza joined
05:22 <pounce> Oh, i'm getting a weird error rn. let me throw it up in a gist
05:23 <geekosaur> (what you can;t do without an extension is something like `foo (x :: Int) = ...`
05:23 <* hackage> hoist-error 0.2.0.1 - Some convenience facilities for hoisting errors into a monad http://hackage.haskell.org/package/hoist-error-0.2.0.1 (schalmers)
05:24 <pounce> I don't really get this error I'm getting: https://gist.github.com/4e554c4c/eaa4f2ed056d6acea149fe22c8083c8f
05:25 <pounce> I haven't got the function to compile yet, so feel free to ask about the terrible parts of it
05:25 <pounce> oh, and the `:: [[[Int]]]` that was for debugging
05:25 skeuomorf joined
05:26 <pounce> oh, that looks to be maybe my error
05:26 <cocreature> pounce: you are trying to make … ++ (1:l) typecheck as [[[Int]]] which means (1:l) must have type [[[Int]]] and thereby 1 must have type [[Int]]
05:26 <cocreature> :t 1
05:26 <lambdabot> Num p => p
05:26 <cocreature> numeric literals are overloaded so you get the error about the missing num instance rather than a type mismatch
05:27 hellozee joined
05:27 <pounce> yeah, the list was getting pretty nasty before I threw those concats in
05:27 vlatkoB joined
05:27 chat joined
05:28 <pounce> (concat . replicate) seems like it should be another function
05:28 rkrishnan joined
05:29 <dminuoso> gitlab ci, what's the usual mechanism to build docker containers and pushing them onto a registry from within gitlab ci?
05:29 <dminuoso> (With a stack project)
05:30 Big_G joined
05:31 <pounce> ok, well I updated it, and I'm getting a different error. I think it's because my list constructor returns a list for its elements, so I'm getting a [[Int]], but if I do `concat [xs | ... ]` it fails to check in a different way https://gist.github.com/4e554c4c/eaa4f2ed056d6acea149fe22c8083c8f
05:35 fujiy joined
05:35 Ariakenom joined
05:38 codesoup joined
05:38 <dminuoso> :t replicate
05:38 <lambdabot> Int -> a -> [a]
05:38 <geekosaur> do you want to make a list of different xs-s?
05:38 <dminuoso> pounce: Tell me what you think `concat $ replicate 1 1` would do
05:39 wchresta joined
05:39 Lowl3v3l joined
05:41 dented42 joined
05:41 <pounce> dminuoso: I would think it would fail to typecheck because replicate 1 1 would give [1] whichisn't a Foldable [a] ?
05:41 <pounce> but I'm really new so I'm not sure :[
05:42 crobbins joined
05:42 <pounce> geekosaur: no, just a flat list
05:42 <geekosaur> then you're thinking about list comprehensions wrong
05:42 <geekosaur> you are telling it to generate a bunch of list elements, provided by xs, then combine them into one list
05:42 <geekosaur> that is, each generated value of xs is one list element
05:43 Mysterious_Light joined
05:43 <geekosaur> > [ x | x <- [3,4,5] ]
05:43 <lambdabot> [3,4,5]
05:43 <geekosaur> (trivial comprehension generating the original list I gave it)
05:44 <geekosaur> > [ x + 2 | x <- [3,4,5] ]
05:44 <lambdabot> [5,6,7]
05:44 <geekosaur> perhaps clearer as to what's up
05:44 Linter joined
05:45 lektrik joined
05:45 <pounce> hmm
05:46 Destol joined
05:46 jhrcek joined
05:46 tsahyt joined
05:49 <dminuoso> pounce: what should this then do? (concat . replicate 1) <$> [1,2,3]
05:51 osa1 joined
05:52 isenmann joined
05:53 emilypi joined
05:54 <pounce> dminuoso: ok, well I'd assume the same, because from what I know of `<$>` it maps the func on the left to each of the elements in right
05:54 <pounce> so I think that helps me out :)
05:54 dogweather joined
05:56 <pounce> thanks for the help, I'm quite new at all of this
05:56 <dminuoso> pounce: You might want to use list do-notation rather than a list comprehension when it's packed with that much code.
05:57 <pounce> so, is do a more imperative syntax? It looks a bit weird to me (but so does most of haskell)
05:58 <dminuoso> pounce: No, do is a kind of syntax sugar that actually uses >> and >>=
05:58 metalbot joined
05:59 <dminuoso> pounce: Which incidentally list comprehensions are too.
05:59 <dminuoso> But yeah, it gives the impression of an imperative touch while being all functional. =)
06:01 andreabedini joined
06:02 <pounce> ok, I'll take a shot at turning this into do syntax when I'm done with it. Might need some help though
06:02 <pounce> I was looking at a "real project" yesterday and saw a lot of `do`
06:03 SovietBeer_ joined
06:03 gestone joined
06:03 blender joined
06:05 sdothum joined
06:05 tsaka__ joined
06:06 bertschneider joined
06:06 _vaibhavingale_ joined
06:06 <geekosaur> it's convenient when doing I/O, or other things where order matters
06:06 _vaibhavingale_ joined
06:07 slaznick joined
06:08 dogweather joined
06:10 vurtz joined
06:12 keepLearning512 joined
06:13 connrs joined
06:13 Destol joined
06:14 xtreak joined
06:15 phenoble joined
06:16 altjsus joined
06:16 hamishmack joined
06:17 keepLearning512 joined
06:18 <gentauro> Question about newtype, is this syntax valid? newtype FM a = FM { unFM :: forall m. Monoid m => (a -> m) -> m }
06:18 <gentauro> Source: comonad.com/reader/2015/free-monoids-in-haskell/
06:18 <geekosaur> valid with RankNTypes
06:18 <geekosaur> not in standard Haskell
06:19 <gentauro> geekosaur: is that a Pragma?
06:19 <gentauro> {-# RankNTypes #-} ?
06:19 <Axman6> it's a language extension
06:19 <geekosaur> it's a LANGUAGE pragma, or can be specified in other ways (-X option to compiler, or in cabal file etc.)
06:19 <Axman6> {-# LANGUAGE RankNTypes #-}
06:20 language_agnosti joined
06:20 <gentauro> Axman6: thx
06:20 oak joined
06:21 hellozee joined
06:21 <gentauro> I got it to work in the Emacs REPL (:set -XRankNTypes)
06:21 <gentauro> as well
06:22 jedws_ joined
06:23 language_agnosti joined
06:23 alvinsj joined
06:25 amelliaa joined
06:25 alvinsj left
06:25 jedws__ joined
06:26 languag__ joined
06:27 borkr joined
06:27 sysfault joined
06:28 <nsnc> We
06:33 <ahri> I have a function `f :: a -> b -> c` that I wish to map over `a :: Either String (Maybe a)` and `b :: Maybe b`, so if that Either layer wasn't there I'd do `f <$> a <*> b` - so what approach should I take? I can use `b' = pure b` to get them both to be the same 'depth' but I'm still unable to use `f <$> a <*> b'` at that point due to there being 2 layers, so I'm not sure what the idiomatic way to do this is (or indeed how to
06:33 <ahri> search for it!) - I'm almost looking for `(Functor f, Functor g) => (a -> b -> c) -> f g a -> f b -> f g c` but not really as I enjoy using `<$>` and `<*>` and like how flexible and readable they feel
06:33 <ahri> and to be clear, that `f b` could be `g b` - I just want to be able to deal with this impedance mismatch in a nice way
06:34 sysfault left
06:35 somewone joined
06:36 <shiona_> So you wish to discard the possible information the Left could bring?
06:38 <ahri> Perhaps a simpler question is how to cleanly do `(Functor f, Functor g) => (a -> b -> c) -> f g a -> f g b -> f g c` with `<$>` and `<*>`, and I can sort out the depth of layers myself via `pure`
06:38 language_agnosti joined
06:39 bertschneider joined
06:39 language_agnosti joined
06:39 <cocreature> :t \f x y -> runMaybeT (f <$> MaybeT x <*> MaybeT y)
06:39 <lambdabot> error:
06:39 <lambdabot> Variable not in scope: runMaybeT :: f0 b -> t2
06:39 <lambdabot> error:
06:39 <cocreature> @let import Control.Monad.Trans.Maybe
06:39 <lambdabot> Defined.
06:39 <cocreature> :t \f x y -> runMaybeT (f <$> MaybeT x <*> MaybeT y)
06:39 <lambdabot> Monad m => (a1 -> a2 -> a3) -> m (Maybe a1) -> m (Maybe a2) -> m (Maybe a3)
06:39 <cocreature> ^ ahri
06:39 <ClaudiusMaximus> :t liftA2 ?f <$> ?a <*> pure ?b
06:39 <lambdabot> (?f::a -> b -> c, ?b::f2 b, ?a::f1 (f2 a), Applicative f2, Applicative f1) => f1 (f2 c)
06:40 hphuoc25 joined
06:40 <cocreature> :t \f x y -> getCompose (f <$> Compose x <*> Compose y) -- that one might be even nicer
06:40 <lambdabot> error:
06:40 <lambdabot> Variable not in scope: getCompose :: f0 b -> t2
06:40 <lambdabot> error:
06:41 <cocreature> if it worked …
06:41 <cocreature> @let import Data.Functor.Compose
06:41 <lambdabot> Defined.
06:41 <cocreature> :t \f x y -> getCompose (f <$> Compose x <*> Compose y) -- that one might be even nicer
06:41 <lambdabot> forall k1 (f :: k1 -> *) (g :: * -> k1) a1 a2 a3. Applicative (Compose f g) => (a1 -> a2 -> a3) -> f (g a1) -> f (g a2) -> f (g a3)
06:41 language_agnosti joined
06:41 Ariakenom joined
06:42 andreabedini joined
06:43 language_agnosti joined
06:43 chele joined
06:44 zdenal joined
06:44 nshepper1 joined
06:45 lortabac_ joined
06:46 <* hackage> wss-client 0.2.0.0 - A-little-higher-level WebSocket client. http://hackage.haskell.org/package/wss-client-0.2.0.0 (igrep)
06:46 xkapastel joined
06:47 language_agnosti joined
06:47 knupfer joined
06:49 language_agnosti joined
06:50 Kacia joined
06:50 amar joined
06:52 progfun joined
06:52 gregberns joined
06:53 ogrady joined
06:53 imjacobclark joined
06:54 <jle`> ahri: you can double-lifta2
06:54 <jle`> :t liftA2
06:54 <lambdabot> Applicative f => (a -> b -> c) -> f a -> f b -> f c
06:54 <jle`> :t (liftA2 . liftA2)
06:54 <lambdabot> (Applicative f2, Applicative f1) => (a -> b -> c) -> f1 (f2 a) -> f1 (f2 b) -> f1 (f2 c)
06:54 <jle`> :t (liftA2 . liftA2 . liftA2)
06:54 <lambdabot> (Applicative f3, Applicative f2, Applicative f1) => (a -> b -> c) -> f1 (f2 (f3 a)) -> f1 (f2 (f3 b)) -> f1 (f2 (f3 c))
06:54 <jle`> repeat to go as deep as you need
06:54 ddellacosta joined
06:55 encod3 joined
06:55 <imjacobclark> Can anybody help me with a Regex question and FindAllMatches? I want to find out _how many_ matches my regex found, I have the following code: https://pastebin.com/mnbFff6A
06:55 <jle`> note that the behavior of MaybeT's Applicative instance is different than liftA2/Compose
06:55 <imjacobclark> But this is resulting in a No instance for (Foldable (AllTextMatches [])) arising from length error
06:55 davr0s joined
06:55 <jle`> MaybeT's Applicative instance will short-circuit on effects if possible
06:55 <imjacobclark> and I just can't figure out why
06:55 Rayben joined
06:55 <jle`> but liftA2.liftA2/Compose will always execute both effects
06:56 <jle`> in the case of Either though I don't think it matters
06:58 <jle`> imjacobclark: what regex library are you using?
06:58 <jle`> where is AllTextMatches from?
06:58 <imjacobclark> jle`: import Text.Regex.PCRE
06:59 language_agnosti joined
06:59 <imjacobclark> in my package.yaml I have regex-pcre declared
06:59 <jle`> the package is regex-pcre, then?
07:00 <jle`> ah yes, for some reason, AllTextMatches [] does not have a Foldable instance
07:00 language_agnosti joined
07:00 <jle`> length is defined to work for anything with a Foldable instance
07:00 <jle`> it looks like it's probably because it's a really old library
07:00 DarkUnicorn joined
07:00 <jle`> ah yeah, last updated in 2010
07:00 Raybin joined
07:01 <jle`> you can probably use `getAllTextMatches :: AllTextMatches [] String -> [String]`
07:01 <jle`> and then get the length of that [String]
07:02 <jle`> if the library is still maintained, you can probably submit a PR or patch to add the Foldable instance :)
07:03 revprez_ joined
07:03 ian_andrich joined
07:03 alexteves_ joined
07:03 <imjacobclark> jle`: ah okay, thanks!
07:04 <jle`> np!
07:04 bertschn_ joined
07:04 <cocreature> jle`: oh good point, I totally missed the difference between Compose and MaybeT here
07:05 language_agnosti joined
07:05 acidjnk joined
07:05 <jle`> i actually only just realized it a month or two ago after a discussion here on irc
07:06 <jle`> blew my mind
07:06 Jacoby6000 joined
07:06 <cocreature> I’m kind of sad now, my mental model was always that for Applicative you can just use Compose instead of the transformers which is obviously wrong :/
07:07 <jle`> in my mind i rationalize it as a [a] vs ZipList a thing
07:07 ahri` joined
07:08 <jle`> F (Maybe a) has multiple Applicative instances
07:08 <jle`> and only one of them (in general for all Monad F) can also be made into a Monad where (<*>) = ap
07:08 <jle`> the `Compose f Maybe` instance cannot be Monad, like how ZipList can't be Monad
07:09 ssarah joined
07:09 deepfire` joined
07:09 minn joined
07:09 somewone joined
07:10 language_agnosti joined
07:11 alvinsj[m] joined
07:11 remyhr joined
07:13 cybai joined
07:13 fujiy joined
07:14 <ahri`> I'm struggling a bit, I have two Applicatives f & g, a function `f :: a -> b -> c` and a couple of values `a' :: f g a` and `b' :: f g b`, I can't do what I want: `f <$> a' <*> b'` as I have 2 layers of functor/applicative to get through, so how do I approach this?
07:14 <* hackage> distributed-process-async 0.2.6 - Cloud Haskell Async API http://hackage.haskell.org/package/distributed-process-async-0.2.6 (AlexanderVershilov)
07:15 xtreak joined
07:16 <cocreature> ahri`: have you seen the answers that I send to you when you asked this question an hour ago or so?
07:16 language_agnosti joined
07:16 sarna joined
07:16 raichoo joined
07:16 language_agnosti joined
07:17 <ahri`> cocreature: no, I'm using riot.im and it appears to be having difficulties saying it's unable to connect, even on my (now stable) connection
07:17 <cocreature> ahri`: you can use the tunes.org link in the channel topic to take a look at the logs
07:17 bo joined
07:17 <ahri`> awesome, I'll have a look, sorry about that
07:18 agander joined
07:18 Scip joined
07:18 logzet joined
07:19 language_agnosti joined
07:20 <ahri`> ah, double lifting looks like the answer I was looking for, I hadn't considered the liftA* functions for a while, preferring the infix
07:20 Linter joined
07:21 Folkol joined
07:21 <ahri`> getCompose looks interesting, I'll have to read up on that, that may be a prettier way to approach it
07:22 <cocreature> Compose basically wraps up the double lifting so the regular Applicative operators will do that
07:22 CurryWurst joined
07:24 pie_ joined
07:24 bertschneider joined
07:24 thebnq joined
07:26 darjeeling_ joined
07:27 ammazza joined
07:28 AndreasK joined
07:28 connrs joined
07:28 language_agnosti joined
07:28 szymon joined
07:28 progfun joined
07:29 language_agnosti joined
07:30 <ahri`> the Compose solution seems prettiest to me, that's really awesome. I wonder how I might extend this to more than 2 layers of applicative, since the composition of liftA2 is extensible to any degree I encounter in the future
07:31 <cocreature> you can nest Compose
07:31 <cocreature> :t \f x y -> getCompose (getCompose (f <$> Compose (Compose x) <*> Compose (Compose y)))
07:31 dhil joined
07:31 <lambdabot> forall k2 k1 (f :: k1 -> *) (g1 :: k2 -> k1) (g2 :: * -> k2) a1 a2 a3. Applicative (Compose (Compose f g1) g2) => (a1 -> a2 -> a3) -> f (g1 (g2 a1)) -> f (g1 (g2 a2)) -> f (g1 (g2 a3))
07:32 <ahri`> I was worried it might end up looking like that!
07:32 language_agnosti joined
07:32 <ahri`> it's really cool, and especially nice that I can still use the infix, but I feel like multi-liftA2 is more readable
07:32 tromp joined
07:34 <ahri`> thanks a lot to you both, cocreature and jle`!
07:34 <cocreature> once you go above two levels of nesting, you probably want to define some newtype for your monad/applicative stack and always work on that rather than wrap and unwrap the individual values whenever you want to compose them
07:35 <ahri`> hmm I hadn't considered a newtype, that could make things a lot more readable now you mention it
07:36 bod_ joined
07:37 hphuoc25 joined
07:37 dddddd joined
07:38 _vaibhavingale_ joined
07:39 asheshambasta joined
07:40 hphuoc25 joined
07:40 lektrik joined
07:41 altjsus_ joined
07:42 jesyspa joined
07:43 sdothum_ joined
07:44 shannow_ joined
07:45 yeevy joined
07:45 zdenal joined
07:46 language_agnosti joined
07:47 ozzymcduff joined
07:48 Boomerang joined
07:49 nickolay_ joined
07:50 davr0s joined
07:51 bsmt joined
07:51 merijn joined
07:52 <* hackage> show-prettyprint 0.2.1 - Robust prettyprinter for output of auto-generated Showinstances http://hackage.haskell.org/package/show-prettyprint-0.2.1 (quchen)
07:53 Dabo joined
07:53 emilypi joined
07:54 slomo joined
07:56 thc202 joined
07:56 `Guest00000 joined
07:56 <* hackage> show-prettyprint 0.2.2 - Robust prettyprinter for output of auto-generated Showinstances http://hackage.haskell.org/package/show-prettyprint-0.2.2 (quchen)
07:57 hphuoc25 joined
07:58 pie_ joined
07:59 bertschneider joined
08:00 kuribas joined
08:02 <kuribas> "While I love the power of Lisp, I am not a devotee of functional programming. I see nothing bad about side effects and I do not make efforts to avoid them unless there is a practical reason."
08:02 <kuribas> Richard Stallman
08:02 <tdammers> the more I think about it, the more I am convinced that "lisp == FP" is blatantly false
08:03 <veverak> kuribas: like that! source?
08:03 <tdammers> FP is about (pure) functions. Not about first-class procedures.
08:03 <merijn> tdammers: Generally people consider "scheme == FP", which then got bastardized to "lisp == FP" by people claiming "scheme == lisp"
08:04 <kuribas> It's a common myth that FP means avoiding side effects.
08:04 <kuribas> Rather than separating them.
08:04 <kuribas> tdammers: also yeah
08:05 vovs03 joined
08:05 mreh joined
08:05 <tdammers> well, scheme is a lisp
08:05 <kuribas> scheme is more FP than other LISP dialects
08:06 <kuribas> like ocaml, but without static types
08:06 language_agnosti joined
08:06 <ventonegro> By this logic not even SML is a functional language then
08:07 <kuribas> not purely functional
08:07 <tdammers> IMO the minimum requirement is to have some sort of notion of pure functions
08:07 louispan joined
08:07 <ventonegro> kuribas: That was not what he said
08:07 <tdammers> i.e., there must be a way to write actual functions
08:07 somewone_ joined
08:07 <veverak> pure function? Like C? :)
08:07 <veverak> (nut trolling, gcc actually has attribute 'pure' for functions)
08:08 <kuribas> ventonegro: he mentioned LISP in general, not scheme.
08:08 <veverak> yeah, __attribute__((const)) it is, or __attribute__((pure))
08:09 <ventonegro> kuribas: I am talking about the "FP is about (pure) functions" part
08:09 <ventonegro> Granted, "pure" is within parentheses :)
08:10 keepLearning512 joined
08:11 <kuribas> ventonegro: when he says he doesn't mind side-effects, it seems he means pure.
08:11 <ventonegro> kuribas: I'm not talking about RMS
08:11 keepLearning512 joined
08:12 <ventonegro> 10:03 <tdammers> FP is about (pure) functions. Not about
08:12 <ventonegro> first-class procedures.
08:12 <ventonegro> Then I said that not even SML is functional then
08:13 <kuribas> ventonegro: I disagree
08:13 <kuribas> because both SML and scheme are about pure functions. It just doesn't enforce them.
08:13 <mreh> @pl \a b -> f b a
08:13 <lambdabot> flip f
08:13 <mreh> that stills works then \o/
08:14 <tdammers> scheme doesn't really have any means of controlling or containing effects
08:14 <tdammers> any procedure can be called from any context
08:14 <kuribas> ventonegro: that's why scheme has tail-call optimization for example
08:14 pagnol joined
08:14 <ventonegro> kuribas: How so?
08:15 language_agnosti joined
08:15 dogweather joined
08:15 <kuribas> ventonegro: so you don't need to write mutating loops
08:15 freeman42x]NixOS joined
08:15 <tdammers> the problem with not enforcing purity anywhere is that you can't realistically reason about effect (or the absence thereof) anymore
08:16 <quicksilver> < kuribas> It's a common myth that FP means avoiding side effects. Rather than separating them. <-- In my view the actual point here is a surprisingly subtle one about the definition of 'side'
08:16 <maerwald> tdammers: is that really a purity problem?
08:16 <maerwald> tdammers: in java you can nicely reason about all effects that are part of the exception system
08:16 <quicksilver> I believe that FP is about avoid things which occur as side-effects of evaluation.
08:17 <quicksilver> in that particular sense of the word *side*-effects, then I agree with kuribas's first sentence and disagree with his qualification :)
08:17 <ventonegro> kuribas: Not really. The reason was that the authors discovered that evaluating arguments, not function calls, push values on the stack
08:17 <maerwald> tdammers: and even worse, when you have IO in haskell, it is technically pure, but basically removes your ability to reason about the function (unless you read the whole body)
08:17 <ventonegro> kuribas: Scheme was not really about purity in the beginning
08:17 <quicksilver> so, we strive to separate effects and not have them occur implicitly as part of evaluation.
08:17 pbodev1 joined
08:18 <maerwald> and FP is not about avoiding side-effects, FP is about functions :>
08:18 <ventonegro> kuribas: http://repository.readscheme.org/ftp/papers/ai-lab-pubs/AIM-443.pdf
08:18 <kuribas> ventonegro: scheme programmers, unlike lisp programmers, will also avoid using set!
08:18 <ventonegro> kuribas: Yes, as I am one. But that came later.
08:18 language_agnosti joined
08:18 <kuribas> possibly
08:19 <ventonegro> kuribas: This is not at all why Scheme was created with tail call optimization. Just read the paper.
08:19 C-16 joined
08:20 <kuribas> originally scheme was also about the actor model
08:20 reactormonk joined
08:20 <ventonegro> kuribas: Ok?
08:21 tsaka__ joined
08:21 <kuribas> which is why it has call/cc
08:22 <kuribas> quicksilver: exactly
08:22 <kuribas> ventonegro: who uses scheme for scheme for actors now?
08:22 <zincy> How do I use <<**>> to map a 2 arity tuple with a function \(a, b) -> (a, b) ?
08:23 <ventonegro> kuribas: What's your point?
08:23 <kuribas> ventonegro: that scheme like it is used now, is mostly functional.
08:24 arkaros joined
08:24 <ventonegro> kuribas: I don't think anybody disputes that
08:24 <kuribas> ah, ok then
08:25 language_agnosti joined
08:25 <kuribas> tdammers: not everyone thinks that matters.
08:27 <kuribas> :t (<<**>>)
08:27 <lambdabot> error:
08:27 <lambdabot> • Variable not in scope: <<**>>
08:27 <lambdabot> • Perhaps you meant one of these:
08:27 <AWizzArd> Is there an extension available in 8.4 that allows multiple records to have the same field names?
08:28 <AWizzArd> I read about DuplicateRecordFields but also about OverloadedRecordFields.
08:28 <ventonegro> Modern Scheme compilers even optimize for code without assignments, and assignments usually pay the price of an extra box allocation
08:28 orphean joined
08:29 <cocreature> AWizzArd: DuplicateRecordFields exists since 8.0
08:29 <zincy> Maybe what I am looking for is a functor instance which doesn't seem to be possible for my tuple
08:29 <AWizzArd> cocreature: and is that the best solution in 8.4?
08:29 <cocreature> AWizzArd: still the same :)
08:29 <merijn> AWizzArd: Everything related to that is still work in progress, yes
08:30 <AWizzArd> merijn: yes, that was my feeling. It sounded like a proposal.
08:30 <cocreature> OverloadedRecordFields is a proposal and doesn’t exist yet afaik
08:30 <cocreature> and tbh I have my doubts that it ever will exist
08:30 yeevy joined
08:31 cur8or joined
08:32 <kuribas> tdammers: the nice thing is that you can have that and mutation if necessary, like when working with mutable vectors in the ST-monad.
08:33 <pbodev1> :t (<**>)
08:33 <lambdabot> Applicative f => f a -> f (a -> b) -> f b
08:33 <zincy> hmm in the bifunctors package its (<<**>>) :: Biapplicative p => p a c -> p (a -> b) (c -> d) -> p b d infixl 4
08:34 arkaros joined
08:34 zaquest joined
08:34 <zincy> Oh <**> is not <<**>>
08:34 <zincy> :)
08:35 <cocreature> zincy: what exactly are you trying to do? map the same function over both elements in a tuple?
08:35 <zincy> yes
08:35 <cocreature> :t \f -> bimap f f
08:35 <zincy> think foldr but for a tuple
08:35 <merijn> :t \f -> bimap f f
08:35 <lambdabot> Bifunctor p => (a -> d) -> p a a -> p d d
08:35 <lambdabot> Bifunctor p => (a -> d) -> p a a -> p d d
08:35 <merijn> :p
08:35 <cocreature> merijn: hah!
08:35 <zincy> oh that looks like it
08:35 <merijn> :t join bimap
08:35 <lambdabot> Bifunctor p => (c -> d) -> p c c -> p d d
08:35 <merijn> For extra opaqueness!
08:36 <cocreature> if you use lens you can also use "both" but that’s certainly not something that you wan to add a lens dep for
08:36 <zincy> already have a dep on lens
08:36 <kuribas> tdammers: for many people it must feel like unnecessarily restricting yourself, but I find that using purely functional structures has many benefits.
08:36 dogweather joined
08:36 <cocreature> :t over both
08:36 <lambdabot> Data.Bitraversable.Bitraversable r => (a -> b) -> r a a -> r b b
08:36 <cocreature> that’s the lens version
08:38 <zincy> im confused
08:39 <zincy> https://lpaste.net/1456565139699400704
08:39 louispan joined
08:39 <zincy> Essentially I want the deal function to bimap over the tuple of cards
08:39 <zincy> but I am getting Game.hs:48:19: error: • Couldn't match expected type ‘([[Card]], [Player])’ with actual type ‘[Player]’ • In the expression: players In the third argument of ‘over’, namely ‘(pocketCards, players)’ In the expression: (over both) (\ (pockets, p@Player {..} : ps) -> if _playerState == In then (Player {_pockets =
08:40 <merijn> zincy: You seem to have reversed the tuple elements in the input and function processing it
08:41 progfun joined
08:41 <merijn> zincy: Actually, scratch that
08:41 <merijn> You're using "both" to apply a function to each side of a tuple while the function seems to require a tuple as input
08:42 zealvault joined
08:42 <pbodev1> just testing no intrusion :)
08:42 <pbodev1> @let f' = getConst . forwards . traverse (Backwards . Const)
08:42 <lambdabot> .L.hs:159:17: error:
08:42 <lambdabot> Variable not in scope: forwards :: f0 (t b2) -> Const c b0
08:42 <lambdabot> |
08:42 yuuki_ joined
08:43 <zealvault> hey
08:43 <merijn> zincy: Also, this could be cleaner: https://lpaste.net/2892597350721650688
08:43 benjamin-l joined
08:43 <Ariakenom> different a b x = assert a != b $ if x==a then b else a -- is there a function like this lying around somewhere?
08:43 <merijn> pbodev1: You can private mssage lambdabot if you wanna test things
08:44 slackman joined
08:44 <pbodev1> merijn: ah thanks
08:44 zealvault left
08:44 <zincy> merijn : ooh thanks
08:45 <* hackage> versioning 0.2.0.0 - Type-safe data versioning. http://hackage.haskell.org/package/versioning-0.2.0.0 (lortabac)
08:45 xtreak joined
08:48 hphuoc25 joined
08:49 somewone__ joined
08:50 encod3 joined
08:51 progfun joined
08:51 zariuq joined
08:53 hphuoc25 joined
08:53 dogweather joined
08:54 plugin joined
08:55 RegEchse joined
08:55 jud^ joined
08:56 Arcaelyx_ joined
08:58 danso joined
08:59 oish joined
09:02 jeltsch joined
09:05 alex`` joined
09:06 zaquest joined
09:11 xtreak joined
09:11 ziyourenxiang_ joined
09:14 Sigyn joined
09:15 dogweather joined
09:16 <zincy> say I have two lists [1,0,1] and [True,True] what function would give me a [True, False True] as a result
09:16 <Ariakenom> zincy: const [True, False, True]
09:17 <zincy> haha
09:17 <Ariakenom> haw haw
09:17 <veverak> bad question, bad answer...
09:17 NinjaTrappeur joined
09:17 <dminuoso> zincy: what is `False True`?
09:17 <zincy> veverak: what would be a good answer?
09:17 <dminuoso> zincy: that depends on the question.
09:18 <dminuoso> zincy: Your description of an algorithm is rather poor. What is that function supposed to do?
09:18 <zincy> right so bad answer depends on the question too :)
09:18 <veverak> zincy: there is not a one for bad question
09:18 <Ariakenom> > toEnum 1
09:18 <veverak> :)
09:18 <lambdabot> *Exception: Prelude.Enum.().toEnum: bad argument
09:18 <Ariakenom> > toEnum 1 :: Bool
09:18 <lambdabot> True
09:18 <veverak> zincy: to be honet: your question does not make sense
09:19 <zincy> veverak: that makes no sense
09:19 <veverak> *honest
09:19 <zincy> neither of us make any sense
09:19 <zincy> haha
09:19 <veverak> so, what the function should do?
09:19 <veverak> why?
09:19 <dminuoso> :t const const
09:19 <lambdabot> b1 -> a -> b2 -> a
09:19 zaquest joined
09:19 <dminuoso> @pl \_ _ x -> x
09:19 <lambdabot> const (const id)
09:20 <dminuoso> Oh well. Staring at it it seems obvious now.
09:20 <Ariakenom> :t const id
09:20 <lambdabot> b -> a -> a
09:20 <Ariakenom> :t const (flip const)
09:20 <lambdabot> b1 -> b2 -> c -> c
09:20 <dminuoso> Ariakenom: Im starting to prefer the const id perspective now.
09:20 <dminuoso> \_ -> (x -> x)
09:20 <dminuoso> \_ -> (\x -> x)
09:20 <dminuoso> So much more revealing =)
09:21 catsup joined
09:21 <Ariakenom> > map toEnum [1,0,1] :: [Bool]
09:21 <lambdabot> [True,False,True]
09:22 <zincy> ok I want a function which when given two lists and a predicate if the predicate returns false on an element of the first list then for the same index on the second list an arbitrary value will be set
09:22 cur8or joined
09:22 <dminuoso> zincy: map and zip?
09:22 catsup joined
09:23 zerobaud joined
09:23 TipsyMe joined
09:23 <cocreature> an arbitrary value? where is that value supposed to come from
09:23 <zincy> supplied to the function?
09:23 <dminuoso> zincy: do you have some examples of input and output data?
09:23 <cocreature> so you want something like a -> (a -> Bool) -> [a] -> [a]?
09:24 <cocreature> oh wait no, I missed the second list
09:24 <zerobaud> Is there any way to create an algorithm based on X amount of before and after states? For example before A=5, after A=6. An returned algortihm would be A=A-1?
09:24 <cocreature> so b -> (a -> Bool) -> [a] -> [b] -> [b]?
09:24 <Ariakenom> b -> (a -> Bool) -> [a] -> [b]-> [b]?
09:24 <dminuoso> cocreature: There's too much confusion, said the joker to the thief.
09:24 ddellacosta joined
09:26 Gurkenglas joined
09:27 <Ariakenom> :t \z p -> zipWith (\a b -> if p a then b else z)
09:27 <lambdabot> c -> (t -> Bool) -> [t] -> [c] -> [c]
09:27 <dminuoso> @pl \z p -> zipWith (\a b -> if p a then b else z)
09:27 <lambdabot> (zipWith .) . flip (flip . ((flip . if') .))
09:27 <Ariakenom> hmmm
09:27 <dminuoso> @pl \a b -> if p a then b else z
09:27 <lambdabot> flip flip z . if' . p
09:28 <dminuoso> :t flip flip
09:28 <lambdabot> b -> (a -> b -> c) -> a -> c
09:28 <dminuoso> Okay I didn't expect that =)
09:29 <zincy> https://lpaste.net/9095774004509147136
09:30 vonfry joined
09:31 WhatisRT joined
09:32 hphuoc25 joined
09:32 jmnk_ joined
09:33 eliasr joined
09:34 bertschneider joined
09:35 curious_corn joined
09:38 cur8or joined
09:39 revprez_atlanta joined
09:39 louispan joined
09:40 dogweather joined
09:42 ub joined
09:42 <jle`> zerobaud: there isn't any way in general
09:42 hellozee joined
09:42 <jle`> zerobaud: that's basically what the entire field of mathematical modeling tries to look at
09:43 hphuoc25 joined
09:43 <jle`> zerobaud: but it's simple if you know a general shape of what sort of function you want
09:43 cybai joined
09:43 <jle`> well, simple depending on how simple the shape you want is, heh
09:44 <Ariakenom> Creating an nth degree polynomial for n states works for number states?
09:44 <zerobaud> jle`: so lets say state change is limited to logical operations like xor, not, and, sub, mul etc.. and that the state changes are never complex in the sense that you could base behavior on branching (if else etc). It should be trivial right?
09:44 <jle`> zerobaud: sounds kind of like a graph search
09:44 <jle`> but you don't have to ever talk about state here...
09:44 <jle`> you're just talking about a function
09:45 <jle`> there's no need to invoke the idea of state of any kind
09:45 <zerobaud> I guess I see what you mean
09:45 <jle`> you're basically looking for a mathematical function that fits your input and output pairs
09:45 <Ariakenom> zerobaud: Do you want a unique function? Some requirements on the function?
09:46 <jle`> of course this problem isn't a simple one in general
09:46 <zerobaud> Ariakenom: as many as possible, behaving the same as the "black box" function we want to emulate.
09:46 dstolfa joined
09:46 <jle`> this is the basic idea behind, say, image recognition, self-driving cars, game AI
09:46 <jle`> i give you a pair of x-ray images and the diagnosis, and you pick a function that gives the diagnosis from the image
09:46 <jle`> *give you many pairs
09:47 <jle`> do you see that this problem isn't really a simple one to solve in general?
09:47 Yuras joined
09:47 chat_ joined
09:48 <Ariakenom> But so far the simplest solution is to fit a polynomial to the curve f x = y
09:48 <jle`> right, that's technically correct, but will almost never generalized to unseen data points
09:48 <jle`> it also doesn't work if the same x is paired with different y's in observation
09:49 <zincy> In high school my biology teacher's approach was draw a straight line with a ruler that looked right across the graph
09:49 <Ariakenom> with different mappings it's not a function or algorithm
09:49 remyhr joined
09:49 <jle`> zincy: yes but that only works if your data points generally approximate a line
09:50 <zincy> Yes I found it funny though
09:50 <jle`> it's definitely not a simple problem in general, and is probably unsolvable in the general case
09:50 <zincy> Such mathematical rigout
09:50 <zincy> rigour
09:50 <jle`> but if you have the general shape of the function you want, you can get some useful results
09:51 Linter joined
09:51 <jle`> zincy: do you have a specific problem you are trying to solve?
09:51 <zincy> surely there is a better way to minimise error with a linear regression than taking a rules and drawing a line which feels right
09:51 <zincy> nope
09:52 <jle`> depends on what measurement you are using for 'better'
09:53 <Logio> zincy: drawing a line by hand is usually "good enough"
09:53 dogweather joined
09:53 asheshambasta joined
09:54 <kuribas> zincy: least squares fit?
09:54 <jle`> oh sorry, that question was meant for zerobaud
09:54 <jle`> zerobaud: do you have a specific problem you are trying to solve?
09:54 <zerobaud> well, yes.
09:54 <Logio> from experience, calculating the LS fit on pen and paper causes much more strain on the wrist for very little gain
09:55 <zincy> So all of machine learning is just the game of find this magic function?
09:55 <jle`> you'll probably get much better help the more specific you ask, here
09:55 <zerobaud> Ehm, I need to create basic blocks from a binary, and then modify them and write them back.
09:55 <jle`> zincy: not necessarily all
09:55 <zincy> What about generalised AI? Such a thing surely wouldnt be reducible to such a simple problem
09:55 <jle`> zerobaud: what is a basic block?
09:56 <zerobaud> jle`: defined more or less like "https://en.wikipedia.org/wiki/Basic_block" - TLDR series of assembly instructions with no flow control changes other then next instructions is the next instruction.
09:57 <zerobaud> link does not work since the last quote gets appended to the url
09:57 <jle`> how do you mean, create a basic block from a binary?
09:57 <zerobaud> jle`: I read the binary in memory
09:57 dogweath_ joined
09:57 <zerobaud> then parse its ELF / PE header
09:58 <zerobaud> then get the .text section (for now) and start dissasembling the instructions
09:58 <zerobaud> The first instruction start the basic block, the basic block ends on JMP / CALL / RET / INT instructions (or if the current is a branch target)
09:58 _bo joined
09:59 <dminuoso> zerobaud: So you want to split machine code into basic blocks?
09:59 <zerobaud> dminuoso: I am already doing that.
09:59 <zerobaud> I want to change the basic blocks to look different while behaving the same and not having ANY knowledge about what the instructions are.
09:59 <zerobaud> besides knowing which instructions they are not... so I kind of know the ones that I will encounter.
09:59 <zerobaud> But I should not know what they do
10:00 arkaros joined
10:00 <LiaoTao> https://en.wikipedia.org/wiki/Polymorphic_code
10:00 knupfer joined
10:00 <zerobaud> LiaoTao: nope, polymorphic code does not have anything to do with this, polymorphic has a encryptor / decryptor or encoder / decoder.
10:01 __bo joined
10:01 davr0s joined
10:01 <zerobaud> If you want to define what I am doing, it is more like a metamorphic engine.
10:01 <dminuoso> zerobaud: In effect peephole optimizations?
10:01 <zerobaud> dminuoso: I guess yes, except that they dont have to optimise the code. But its the same context as peephole optimizations.
10:02 <jle`> zerobaud: if you only have a limted number of instructions, you can just enumerate over all possible programs
10:02 <jle`> until you find one that matches
10:02 <zerobaud> If I give two sets of state (registers / cpu flags) of the start of the basic block and the end. How can I syntesize equally behaving basic blocks?
10:02 mariatsji joined
10:03 <jle`> all you can do is observe several input/output pairs?
10:03 <zerobaud> jle`: but I need multiple tries at least: since a NOP would satisfy before = "1" after = "1" while the input was 1.
10:03 <zerobaud> but the basic block actually did input * 1 = output
10:03 <jle`> zerobaud: so, you only have one possible try?
10:03 <zerobaud> no I have many
10:04 <zerobaud> But these edge cases, I dont know of a mathemtical model that can assure me that my synthesized basic blocks behave the same
10:04 <zerobaud> how can we even define equality? its obvious its not the input and output for only 1 try
10:04 <zerobaud> you need at least 2 tries but how many do you need really?
10:04 <jle`> if your registers are finite, you can just test all possible inputs and outputs
10:05 <zerobaud> So there is indeed a limit for test cases that can assure the blocks are identical...
10:05 <zerobaud> what optimizations can I make?
10:05 <zerobaud> Can I proof somehow that if it holds for X inputs and outputs it will hold always?
10:05 <jle`> the limit is that you only have a finite number of possible test cases
10:05 machinedgod joined
10:05 <jle`> if your registers are finite
10:05 <jle`> you don't have infinite possible test cases.
10:05 <zerobaud> true
10:06 <zerobaud> so we are good in the sense we can define equality 100%
10:06 <zerobaud> just by trying all cases
10:06 <zerobaud> but how can we define it more efficiently?
10:06 <jle`> the general thing you are looking at is called PL semantics
10:06 <zerobaud> Maybe we can proof that we only need 3 cases?
10:06 <zerobaud> with 3 different numbers?
10:06 <jle`> the field of defining what it means for programs to be equal
10:07 <jle`> zerobaud: you can't really say anything like that without limiting your operations
10:07 <zerobaud> they are limited, mostly to logical operations like xor, not, and, or, add, sub, mul, div
10:07 <zerobaud> basically they are all there are
10:07 <jle`> right, but do you see how we cannot say anything with certainty unless we consider *all* the operations
10:08 <jle`> you can't just talk about some of them
10:08 <zerobaud> you are rtight, okay lets limit the set to the afromentioned onces
10:08 <zerobaud> how would we go about optimising the cases? can we proof that if it holds for X different cases its equal?
10:09 lastmanstanding joined
10:09 <zerobaud> this is (probably) highly dependent on the operation, what works for xor would not for add I guess...
10:10 <jle`> i do'nt think so. if you can "nxor" with arbitrary numbers, then there's no way of finding which number you are nxoring with unless you try all combination
10:10 <jle`> er hm i stated that incorrectly
10:11 <jle`> if you can find a way to test for equality to a given number, then there's no way of finding out what number that is unless you try all combiations
10:12 <jle`> so if "equal to 8952734545" is a possible operation somehow, then you can't test what that program would be except for trying all possible numbers.
10:12 louispan joined
10:13 <jle`> you can probably define an "equal to" operation in terms of successive bit shifts and xor's.
10:14 cloudhead joined
10:14 AndreasPK_ joined
10:15 dogweath_ joined
10:15 <dminuoso> Any docker and gitlab users here? How do you do CI?
10:16 keepLearning512 joined
10:16 <dminuoso> If I want my gitlab runner to build a docker image, I cant use fpco/stack-build, and if I use the docker base image I'll have to manage the tooling myself.
10:17 <dminuoso> Do I just have to bite the bullet and configure my Dockerfile to set up stack and clang?
10:17 v0d1ch joined
10:19 sigma_ joined
10:20 encod3 joined
10:20 <sigma_> if Maybe is a monad how to bind it's value to a variable like we can do for the IO monad >?
10:21 <dminuoso> sigma_: you dont "bind" really
10:21 malice joined
10:21 <dminuoso> sigma_: do-notation is just syntax sugar for (>>) and (>>=)
10:21 <malice> Hi! I'm using Emacs, but I forgot how to run haskell's REPL
10:21 <dminuoso> sigma_: The logic you are looking for is described by (>>=)
10:21 <malice> What commands are there to do that? I'm not thinking of run-haskell
10:21 <malice> (the one I'm thinking about makes prompt be a lambda symbol)
10:22 <ventonegro> :t Nothing >>= Just
10:22 <lambdabot> Maybe b
10:22 <sigma_> dminuoso : i'm aware of the that but we can infact bind the value a monad encapsulates to a variable right ? like this a <- m where m :: IO String
10:22 <Boomerang> Well you can still use do notation for Maybe
10:22 <dminuoso> sigma_: for example: when you write `do { a <- getLine; putStrLn ("Hello" ++ a) }` it's desugared into `getLine >>= \a -> putStrLn ("Hello" ++ a)`
10:22 <dminuoso> sigma_: so its not really
10:22 <dminuoso> "binding"
10:23 dogweather joined
10:23 <ventonegro> :t Nothing >>= (+ 1) . Just
10:23 <lambdabot> Num (Maybe b) => Maybe b
10:24 <dminuoso> sigma_: It's just a way of taking `Maybe a`, and some `a -> Maybe b` and plumbing them together in a lawful manner.
10:24 xtreak_ joined
10:24 LiaoTao joined
10:25 <sigma_> dminuoso : i'm confused now because i can do this for IO monad and not for Maybe moand?
10:25 <Boomerang> > do { x <- Just 2; y <- Just 3; z <- Just (x + y); return (z + 2) }
10:25 <lambdabot> Just 7
10:25 <dminuoso> :t (>>=)
10:25 <lambdabot> Monad m => m a -> (a -> m b) -> m b
10:25 <dminuoso> sigma_: It's all about this function.
10:25 <dminuoso> And
10:25 <dminuoso> :t return
10:25 <lambdabot> Monad m => a -> m a
10:25 <Taneb> Hmm, should there be an instance Monoid e => Alternative (Either e)? that either gives you the first success or an accumulation of failures
10:26 <merijn> sigma_: The thing is that do notation requires that whatever comes out of that block still be "in" the original monad
10:26 <merijn> Taneb: Maybe you want Validation?
10:26 <sigma_> dminuoso : yeah one applies a value in context to a function and another puts a value in default context still not clear
10:26 <merijn> Taneb: Although that's slightly different in that it gives you either 1) all failures or 2) all successes
10:26 <dminuoso> sigma_: do-notation is just syntax sugar around (>>=) nothing more.
10:26 <Taneb> merijn: I'm aware of Validation :)
10:26 <dstolfa> a monad is just an adjunction with two natural transformations, what's the problem?! :)
10:27 <dminuoso> a monad is just the composition of two adjoint functors, whats the problem?
10:27 <dstolfa> dminuoso: a monad is just a monoid in the monoidal category of endofunctors, what's the problem?
10:27 <Boomerang> Taneb: Yeah but there's Validation from the validation package and the one from the either package
10:27 <Taneb> I'm just wondering whether this is a valid/useful instance
10:27 <merijn> This joke is so dead it's starting to resemble a lich....
10:27 <merijn> Boomerang: They have the same semantics, though
10:27 <dstolfa> merijn: ah see, but people keep coming up with new ways to define a monad
10:28 <dstolfa> merijn: and keep adding the "what's the problem?" :)
10:28 <dminuoso> dstolfa: an applicative is just a monoid in the monoidal category of endofunctors equipped with the Day convolution operator.
10:28 <Boomerang> I remember they had a small difference, can't remember what, I'll have a look
10:28 <dminuoso> dstolfa: My favourite one is still the kleisli category route.
10:28 <dminuoso> It feels very clean :)
10:28 <Taneb> It'd make Either () and Maybe pretty much exactly the same
10:28 <merijn> sigma_: Personally I recommend newcomers avoid using do-notation entirely until they're comfortable writing stuff with >>= and >> and only *then* switch to do-notation
10:28 <merijn> Taneb: Simple solution
10:28 <dstolfa> dminuoso: yes, i agree
10:28 <dstolfa> dminuoso: or the comonad one
10:29 <merijn> Taneb: "Validation Error (First Result)"
10:29 <Taneb> merijn: again, I'm not actually looking to use this
10:29 <merijn> Taneb: Yeah, but that proves it's lawful :)
10:29 <dminuoso> dstolfa: Whats that?
10:29 adjofun joined
10:29 <Taneb> merijn: assuming Validation and Either have the same Applicative
10:29 <merijn> Taneb: Because you can reformulate it as two lawful instances
10:29 <Taneb> (which iirc they don't)
10:30 <merijn> Validation and Either don't have the same Applicative, no
10:30 <dstolfa> dminuoso: a monad is just a comonad of the dual of the opposite category :)
10:30 <sigma_> merijn : what the fact that do is syntactic sugar for >>= and >> has to do with the fact that i can't bind Maybe Int to a value without pattern matching or using formMaybe
10:30 tzemanovic joined
10:31 <jle`> sigma_: you can bind the Int
10:31 <merijn> sigma_: You can, though?
10:31 mnoonan_ joined
10:31 <jle`> @let bindTheInt x = x >>= \i -> Just (i + 3)
10:31 <lambdabot> Defined.
10:31 <jle`> > bindTheInt (Just 4)
10:31 <lambdabot> Just 7
10:31 <edwardk> a comonad is just a comonoid object in the category of endofunctors, what is the problem?
10:31 <jle`> there, 'i' is bound to 4
10:31 <dstolfa> edwardk: monoidal category*
10:31 <zerobaud> jle`: but in order to perform if operations we must branch, the basic blocks by definition do not include branching. You might set a flag that gets used later to branch. But this is part of the transformed input forming the output that needs to be replicated.
10:32 <dstolfa> also it's a monoid
10:32 <edwardk> its a monoid in the dual category
10:32 <Taneb> merijn: this'd follow the MonadPlus laws as well
10:32 <jle`> zerobaud: you can implement "equal to 5" in terms of xor's and bitshifts, i think? so you don't need any ifs or branching
10:32 <sigma_> merijn : ??
10:32 <dminuoso> edwardk: What is the most obscure definition of a monad that you can think of?
10:32 <jle`> zerobaud: a function that is 1 if a value is equal to 5, and 0 otherwise
10:33 <Taneb> I'm going to email the appropriate mailing list about this
10:33 <merijn> sigma_: See jle`'s example?
10:33 <dstolfa> edwardk: depends on which perspective you think about it from, sure :)
10:33 <dstolfa> edwardk: my point was that you can think about it in both ways
10:33 <dstolfa> so it's even more obscure
10:33 <Boomerang> So merijn it looks like Validation from either has an instance for Alternative that validation doesn't supply
10:33 <zerobaud> jle`: I think, yes you are right... does this prove that for the subset we choose ALL values must be tested? (I think it does)
10:34 Np-Harda` joined
10:34 <Boomerang> That's because Validation from validation doesn't accumulate errors in the Alt instance
10:35 <edwardk> well its a comonoid object in ([C,C],Compose,Identity). “the (monoidal) category of endofunctors equipped with functor composition, the same place where monads are monoid objects.
10:35 <zerobaud> what if we can generalize the problem, instead of testing for 5 we can substitute it with any other number. Can we syntetise an algorithm and proof it works for the generalization of the compare?
10:35 <jle`> zerobaud: yes if you have at minimum xnor and div
10:35 <Boomerang> (and doesn't require Semigroup on err like the one in either does)
10:35 <merijn> I don't like the validation package anyway, too many lenses and obnoxious ways to deal with them
10:35 <merijn> Validation in either is so much cleaner
10:35 <jle`> zerobaud: i don't know what you mean
10:35 <Boomerang> I agree :)
10:35 <jle`> merijn: Validation in transformers is best
10:35 <jle`> since it comes with ghc
10:36 <merijn> jle`: There is no Validation in transformers?
10:36 <zerobaud> jle`: well I think I know enough for now, I am not able to formulate my questions. Thank you so much showing me that all inputs are necesary in the conditioned we outlined above!
10:36 <jle`> merijn: there is but they don't call it Validation
10:36 <jle`> it's called Errors
10:36 simukis joined
10:36 <merijn> jle`: That's not the same
10:37 <merijn> jle`: That can't generate successes
10:37 <jle`> it can with pure ?
10:37 <merijn> ah, I missed lift
10:37 <merijn> But that doesn't slot nicely into coding using Either
10:38 <jle`> it pretty much has the same API as the validation one :o
10:38 <Taneb> I've emailed the libraries mailing list :)
10:39 tsaka__ joined
10:39 <Taneb> Although last time I did that it turned out it'd already been implemented when I wasn't paying attention
10:40 <jle`> Taneb: Monoid e => Alternative (Either e) would be nice, except transformers defines an orphan instance for Alternative (Either e)
10:40 <jle`> so it'd have to happen at the same time as a change in transformers
10:40 <jle`> why does transformers even have that orphan instance
10:41 <jle`> this is one of the greatest haskell ecosystem mysteries, to me
10:41 <Taneb> jle`: soon it may no longer be an orphan but be in its rightful place!
10:41 <edwardk> dstolfa: guess i’d say “iff F -| U, UF is a monad” since it is sufficient to define them all thanks to Kleisli and E-M, so it can be read both ways and is informative about the nature of adjunctions, which are largely why category theory came into existence in the first place
10:41 <jle`> it is at the moment Error e => Alternative (Either e)
10:42 <jle`> so if anyone uses it, Monoid e => Alternative (Either e) would break any code currently using Either's Alternative instance :'(
10:42 plugin joined
10:42 <jle`> but i suspect that not many people are using it in the first place
10:42 Solonarv joined
10:42 <edwardk> jle`: we at least got Error out of the Monad constraint for Either e
10:43 <dstolfa> edwardk: i'm happy with everything you've said, i just tried to make it more convoluted :)
10:43 <jle`> edwardk: oh, was that actually a thing?
10:43 <edwardk> yeah used to live right next to that instance you hate
10:43 <jle`> hm
10:43 language_agnosti joined
10:43 <dminuoso> edwardk: That intuition is not very useful for Haskell though is it? Do the adjoint functors even exist for most Monad instances?
10:44 <jle`> that deserves some commending :)
10:44 <jle`> but, dropping the constraint wouldn't break any code that already used it, would it?
10:44 <dstolfa> dminuoso: they definitely exist, but they may not directly usable in haskell! :)
10:44 <edwardk> dminuoso: not that can be defined on functors from hask->hask
10:44 <edwardk> the only one you really have there is the prod-hom adjunction
10:44 <jle`> in this case we're changing the constraint, so this would break almost all code that uses Alternative/MonadPlus for Either
10:44 andreabedini joined
10:45 hellozee joined
10:45 progfun joined
10:45 <edwardk> and you can define cont in terms of the adjunction given by function-from but that goes through hask^op
10:45 Gurkenglas joined
10:45 HZun joined
10:46 <edwardk> jle`: basically nothing has happened there because all of those options suck for folks who have defined an Error instance that happens to be a monoid.
10:46 <edwardk> Error is kinda meh, but it does offer a touch more info than Monoid in that situation
10:46 <dminuoso> edwardk: with prod-hom adjunction you mean state/store?
10:47 Ukari joined
10:47 <edwardk> (,e) -| (->)e which gives rise to state and store
10:47 <jle`> edwardk: the accumulation characteristics are different, compared to the (presumed) Monoid-based instance
10:47 <jle`> although i'm not sure if i would ever find that useful
10:48 <edwardk> and the cont one uses (->r) -| (->r)
10:48 kefin_ joined
10:48 <edwardk> accumulation is why things like Validation exist
10:50 language_agnosti joined
10:50 <adjofun> edwardk: Maybe you can help me. I am searching for paper, in which author described that parametrized types are repelling all arguments against functional languages. Such arguments are pretty old, 1960s iirc.
10:51 <edwardk> anyways it isnt clear that the laws of MonadError allow grouping up errors this way, in fact its kinda strongly implied that it doesnt
10:51 <edwardk> adjofun: not sure i can help you. doesnt sound familiar
10:52 <Taneb> Ugh, I forgot how very slighty tedious replying to mailing list emails is in GMail
10:53 asheshambasta joined
10:53 <Taneb> Have to carefully reply to librarys@ and not just one person
10:53 <adjofun> edwardk: welp, no effective propaganda in my workplace then =:)
10:53 saurabhnanda joined
10:53 dogweath_ joined
10:53 <dstolfa> adjofun: parametrised types in the dependent type sense?
10:54 <Taneb> adjofun: only thing springing to mind is John Hughes' Why Functional Programming Matters
10:54 <adjofun> dstolfa: no, just types like `f a` as opposed to types `a`
10:54 <adjofun> Taneb: will look
10:54 Ukari joined
10:54 <dstolfa> adjofun: what does "f" represent here
10:54 bertschneider joined
10:55 <dstolfa> are you talking about types depending on types? i.e. List(a)?
10:55 <zincy> What should I look for if my quickcheck test fails to terminate?
10:55 knupfer joined
10:55 <Np-Harda`> hi everybody
10:55 <zincy> I guess infinite loop would be the only way?
10:56 keepLearning512 joined
10:56 <adjofun> dstolfa: Generally functors, i.e context attached to a type to laypeople
10:56 ammazza joined
10:56 <dstolfa> adjofun: but in a type-theoretic sense, are they types or terms?
10:56 <merijn> zincy: Install a timeout?
10:56 <dstolfa> are we talking about a type depending on a term or are we talking about a type depending on another type
10:57 <dstolfa> because f a could just as well have been List a
10:57 <dstolfa> if they're both types, that is
10:57 pagnol joined
10:57 <dstolfa> if f is a term, then we're talking about dependent types and we can augment it to a calculus of constructions and eventually end up proving theorems
10:57 Wuzzy joined
10:57 <zincy> merijn: What does that mean :/
10:58 <merijn> zincy: Wrap the tests with a timeout that throws an exception after X seconds?
10:58 HarveyPwca joined
10:59 louispan joined
11:00 <adjofun> dstolfa: the point of paper is that Maybe a is more useful than a (encapsulates valid null state), List a is more useful than a (encapsulates many possible values in one), and ad infinium iirc
11:00 ijks joined
11:01 <dstolfa> adjofun: i mean, sure, but why is this exclusive to functional programming?
11:02 ijks joined
11:02 <dstolfa> one nice thing about functional programming is composability, that's how we get shit done. we write primitives and compose them instead of rewrite a bunch of things but a little bit differently
11:03 <dstolfa> in imperative languages, i.e. ones like C, you can write it similarly, but it's not really built for it and it becomes quite ugly
11:03 <zincy> merijn: How would you do that?
11:03 <dstolfa> but when it comes to types depending on other types, i.e. Maybe a, List a and so on, you can do that just fine
11:04 philippD joined
11:04 <merijn> zincy: https://hackage.haskell.org/package/base-4.11.1.0/docs/System-Timeout.html#v:timeout for example?
11:05 <zincy> merijn : Thanks!
11:05 <zincy> so how would we represent failure within types in imperative languages?
11:06 JimmyRcom_ joined
11:06 arkaros joined
11:06 <dminuoso> zincy: Java has checked exceptions
11:06 <zincy> Javascript has null
11:06 <dminuoso> zincy: Optional types are also a way.
11:06 <adjofun> dstolfa: so, type composition is not a buzzword for a while now, I know, but I am still in need to show to Java programmers that they can use generics more effectively
11:06 <adjofun> so, the question about that paper persists
11:07 AndreasPK_ joined
11:07 <zincy> Has anyone here come from say a long background in imperative languages like java or c? Did they find that it made haskell much tougher?
11:08 <adjofun> zincy: I wrote C before Haskell. I consider Haskell a better C now.
11:08 <dstolfa> adjofun: i mean, the point of type systems in programming languages is to help you catch runtime problems at compile-time (usually anyway)
11:08 <merijn> zincy: I mostly did Java, Python, and C when I started in university
11:08 <dstolfa> so why not use them :)
11:08 <cocreature> zincy: I have but I don’t really have anything to compare it to so it’s hard to say if it made it harder
11:08 <merijn> zincy: And most of my work is still C/C++
11:09 <merijn> zincy: I think it depends very much on your exact imperative background
11:09 <dstolfa> i come from a background of developing kernels where ad-hoc C is praised
11:09 <zincy> I guess maybe not really having a background before starting haskell was an advantage in my case
11:09 <dstolfa> it's not fun
11:09 <merijn> zincy: For example, most HPC C++ programmers I talk to find Haskell fairly easy to grasp, because due to their experience with the problems caused by mutability and manual memory maangement they appreciate Haskell's choices more ;)
11:09 <zincy> interesting
11:10 <adjofun> dstolfa: Yeah, why not. Tell than to old corn knobs in my workplace. I can only sway tham with recogniced authorities, sadly, like Dijkstra =\
11:10 <merijn> zincy: But people who write CRUD applications in Java, probably find it hard due to being "too different"
11:10 <zincy> merijn: For your own projects what split of you work is in haskell vs c/c++
11:10 <dstolfa> adjofun: so, they'll listen to dijkstra but not to alonzo church? ;)
11:10 <merijn> zincy: All the code I *can* write in Haskell is in Haskell :p
11:10 <dstolfa> merijn++
11:10 <zincy> hehe
11:11 <merijn> zincy: Last year I spent a ton of time replacing a bunch of python scripts with Haskell
11:11 <dstolfa> merijn: exactly this
11:11 ub joined
11:11 <merijn> zincy: Massively improved my life
11:11 <dstolfa> i have to write C for the most part, but if i get the chance, it'll be haskell
11:11 fendor__ joined
11:11 <adjofun> dstolfa: generally they listen more to whitepapers than to me =\
11:11 <merijn> zincy: A lot of people say that python is amazing as "glue language" because it's so easy to call out to C when you need speed
11:11 <zincy> is c worth learning just to learn about memory management
11:11 <dstolfa> zincy: it's not even good memory management, it's actually crap
11:11 <merijn> zincy: I would say that Haskell actually makes it much easier to interact with C than python
11:11 <dstolfa> flat addresses spaces, storing metadata out of bounds
11:12 <dstolfa> compilers often doing the wrong thing
11:12 <zincy> what niche does python fill I never understood it
11:12 <dstolfa> if i were to recommend C to someone, it would be just so they realise how terrible it is
11:12 <dstolfa> what a terrible language
11:12 <zincy> hahaha
11:12 <merijn> dstolfa: I would say learning C is still important, not because of the language, but because understanding it requires a bunch of useful knowledge about stuff like linking, ABIs, etc. that is relevant in Haskell too
11:12 silver joined
11:12 <dstolfa> merijn: i agree :)
11:12 <merijn> dstolfa: ANd there's much more literature explaining linkers for C than Haskell :p
11:13 <dstolfa> argh linkers
11:13 <zincy> say you only know a bit of haskell and javascript would a bit of c be the next logical step?
11:13 <* dstolfa> has done some lld work
11:13 <* dstolfa> does not like linkers
11:13 <merijn> zincy: A bit of C and/or just basic computer architecture
11:13 emilypi joined
11:13 <zincy> I bought a kindle book on computer architecture to read in bed :)
11:13 <merijn> zincy: Basic computer architecture and OS stuff is *important* if you don't wanna write webapps for life
11:14 <merijn> zincy: Tanenbaum's "Operating Systems: Design & Implementation" is a very good and accessible book
11:14 <zincy> webapps are fun but I file like there is a growing chasm between the skill of web app developers and non-web app developers
11:14 <mniip> merijn, yeah but these days what isn't a webapp :p
11:14 <merijn> He has a good book on architecture too, although that's probably considerably more dated
11:14 <mniip> even ghc is WEBSCALE
11:14 <merijn> mniip: Someone has to write the hard backend stuff :p
11:14 <mniip> just wait until chrome is rewritten in asm.js
11:15 <dstolfa> here's my take on the whole thing, as someone who spends most of his time working on kernels, compilers and CPUs but has a background in maths: doing systems is a great way to realise what the shortcomings of current systems are (there are many) and what problems you encounter in the real world so that you can apply the maths meaningfully.
11:15 <cocreature> I’ve had good experience with throwing my hands in the air and sighing really loud whenever I have to mess with the linker. way less work than actually learning how they work
11:15 <Taneb> cocreature: :D
11:15 <adjofun> merijn: It also can push you to write your own kernel, and to start flame wars with Tanenbaum ;)
11:15 cybai joined
11:16 <dstolfa> merijn: many arch books are outdated :/
11:16 <merijn> adjofun: Naah, what pushed Linus was the fact that Tanenbaum was continuously rejecting 3rd party additions/contributions
11:16 <dstolfa> merijn: i find it surprising that very few books mention the shortcomings of an MMU-based architecture
11:16 chat joined
11:16 <merijn> cocreature: I've always pawned my linker problems on other people :p
11:16 whaletechno joined
11:16 <merijn> dstolfa: MMU's are my friend!
11:17 <cocreature> merijn: that sounds like another nice solution :)
11:17 <merijn> Virtual memory is best memory!
11:17 <zincy> I dont even know what a linker is and get the feeling I dont want to find out
11:17 <zincy> whenever stack build throws a linker err I dont know what to do
11:17 <dstolfa> merijn: unless there's too many TLB entries, then the disk is your friend :>
11:17 <adjofun> zincy: No, you do need to know that =)
11:17 <merijn> zincy: Linkers take libraries and object files (basically, machine code) and links them together into a single executable/library
11:17 hellozee joined
11:17 <zerobaud> jle`: wow check this! https://github.com/StanfordPL/stoke
11:18 <merijn> dstolfa: I just mmap all the things!
11:18 <merijn> Best syscall in existence!
11:18 <dstolfa> merijn: i think that's a bit of an oversimplification. they actually take object files that have certain structure and produces certain formats that the OS can interpreter to spawn a process (ELF, Mach-O, COFF)
11:18 <zerobaud> I dont know what verification algo they use, I will study STOKE and its underlying concepts once I am home. My boss is already thinking I am slacking again (which I am)
11:18 <adjofun> zerobaud: did someone just applied genetic algorithm to code transformations?
11:18 <merijn> zincy: PHK's "You're Doing it Wrong" is a good intro into *why* you need to know this stuff: https://queue.acm.org/detail.cfm?id=1814327
11:18 <mniip> dstolfa, in what case can you have too many TLB entries
11:19 <mniip> I'm assuming you do use hugepages when possible right?
11:19 <dstolfa> mniip: sandboxing. the only way to isolate things in an MMU-based architecture is to duplicate the TLB entries (i.e. fork a process)
11:19 <dstolfa> that's why chrome starts conflating sandboxes eventually
11:19 <cocreature> zerobaud: stoke is pretty cool, there is a nice talk about the optimization part on youtube iirc
11:19 <zerobaud> adjofun: I dont think STOKE uses genetic algorithms. from what I can see it justs tries untill it finds something quciker / better etc...
11:19 <mniip> hol up
11:19 <mniip> TLB vs page table
11:19 <zerobaud> cocreature: awesome, that will be a good starting point thanks!
11:20 louispan joined
11:20 <cocreature> zerobaud: stoke does mcmc on the assembly and uses some heuristic to judge performance iirc
11:20 arkaros joined
11:20 <mniip> dstolfa, if I recall correctly TLB is flushed on context switch so multiple processes have no play in it at all
11:21 <dstolfa> merijn: phk is a nice person but very opinionated and can be hard to discuss some things with he's very opinionated on (personal experience :))
11:21 <mniip> except for the kernel pages which stay in there forever unless PTI is turned on
11:21 <cocreature> anyway, I’ll shut up now since it’s not really related to Haskell :)
11:21 <mniip> (or they are evicted by the process pages)
11:21 <quicksilver> merijn: I was unaware of that paper. Thanks, it looks interesting (from the first few pages)
11:22 <adjofun> zerobaud: I am pretty sure that "random transformation, and evaluating that transforamtion with respect to X" is in essence a genetic algorithm.
11:22 <dstolfa> mniip: that's not true, having more processes means you have more TLB entries, which means that pages go to disk once it's full. the more you have, the more go to disk. the worst case scenario is that you always access the page on disk and evict the next one you need to access. this is a very well known problem, described back in 2008-ish and we've since moved on to different architectures that natively
11:22 <zerobaud> adjofun: I see, well my knowledge is limited in that regard.
11:22 <dstolfa> support sandboxing without any kind of MMU (CHERI, for example)
11:22 YongJoon joined
11:22 <mniip> "go to disk"?
11:23 <mniip> I'm sorry?
11:23 <mniip> do you have the same "TLB" in mind as I do
11:23 valentinbuza joined
11:24 <mniip> Translation Lookaside Buffer, the cache that caches GDT->PD->PT lookups
11:24 <merijn> quicksilver: Not really a peer-reviewed paper, more of an essay/editorial, but still interesting
11:24 <dstolfa> mniip: the problem is that you can't cache all the pages, so what you do is you put them on the disk to page them in later (so you can actually access things in physical memory). if you try to access something in physical memory and it's not present, you will get a page fault. the page fault handler is responsible for paging these things in (i.e. reading them from some storage, usually the disk)
11:24 <mniip> sure
11:24 <mniip> but what does this have to do with filling up the TLB
11:25 <mniip> you can have more "present" pages than the TLB can fit
11:25 <dstolfa> mniip: because when you fork a process, you end up with more pages
11:25 ddellacosta joined
11:25 <dstolfa> mniip: the more pages you end up with, the slower it is when you access them
11:25 <mniip> sure
11:25 <merijn> dstolfa: Only *if* you access them :)
11:25 <mniip> but disk is not involved whatsoever
11:25 <mniip> also only on context switch
11:25 <dstolfa> merijn: well, why would you even bother sandboxing then? :)
11:25 __monty__ joined
11:25 <dstolfa> just remove the code
11:25 <dstolfa> merijn: aehm, no, it is involved.
11:25 <dstolfa> mniip: ^
11:26 Peaker joined
11:26 <merijn> dstolfa: I don't use virtual memory for sandboxing, I use it because it removes the need for me to think about smart access pattern prefetching and offloading it all to the kernel :)
11:26 <dstolfa> mniip: if you read how the VM subsystem handles these page faults, you'll see that it explicitly goes to disk in one of the backends
11:26 <mniip> dstolfa, you realize there's two different systems at play
11:26 <dstolfa> mniip: it'll go VM subsystem -> something like pmap (which is the arch-specific bits for page tables) -> VFS -> filesystem backend -> disk in one path, for example
11:27 <merijn> dstolfa: You also don't have to worry about freeing/releasing memory, the OS will just page shit out for me and do a pretty good job
11:27 <mniip> dstolfa, I know that very well
11:27 <dstolfa> mniip: then why are you confused?
11:27 <mniip> I think it's you who is confused
11:27 <mniip> pages may get evicted to disk, and they are loaded back when a page fault at a "not present" page occurs, that much is correct
11:27 <mniip> TLB is a completely different story
11:28 <* adjofun> went to grab some popcorn
11:28 chat_ joined
11:28 <mniip> popcorn? we're having a civil discussion
11:29 <Taneb> mniip: some people just like eating popcorn I guess
11:29 <adjofun> mniip: Text doesn't convey emotions, so I always assume flame war =:)
11:29 <dstolfa> popcorn is tasty
11:29 <adjofun> it is
11:29 <mniip> is it sweet popcorn or salty
11:29 saep joined
11:29 <LiaoTao> Unless it's topped with sugar
11:29 <Taneb> I'm not a huge fan of popcorn
11:30 <merijn> #haskell is generally rather flamewar free
11:30 <dstolfa> mniip: but yes, sure, but i still don't understand how more pages is irrelevant for the TLB, it still slows down things the moment you evict things from the TLB
11:30 <Peaker> using alex: Pre-validation (^ rule) does not work, as it ignores skipped tokens :-( using happy: Adding an alternative to an existing grammar *shrinks* the language(??) :-(
11:30 <dstolfa> even if you keep them off the disk (the disk was an extereme example)
11:30 <Taneb> Although now we are extremely off topic
11:30 <Peaker> alex/happy make me sad
11:30 <mniip> dstolfa, yes but things are evicted from the TLB any way
11:30 <Clint> haha
11:30 <mniip> on every context switch
11:30 <__monty__> merijn: I don't know, this popcorn business is getting me pretty irate. Everyone knows potato chips is where it's at.
11:30 <dstolfa> mniip: i'm not too sure about that. what do you mean by "context switch" here?
11:30 <dstolfa> you don't flush the TLB on every syscall, for example
11:31 <dstolfa> that would be far too slow
11:31 <mniip> okay right, when the scheduler switches threads
11:31 <mniip> (but also IIRC when PTI is on it *is* flushed on syscall entry/exit)
11:32 <mniip> (not sure about that)
11:32 <Peaker> Is it supposed to be possible in happy to add " | <option>" to an existing rule - and have it reject previously accepted inputs?
11:32 <Peaker> I thought "happy" generated an efficient parser that acts as if it backtracked to try everything
11:32 <dstolfa> mniip: AFAIK PTI is meant to isolate the kernel maps from the userspace maps, so they only need to flush the kernel bits (which is still a big perf hit, but not as big as a FULL flush)
11:33 <__monty__> Peaker: Are you sure the language shrinks? Maybe the parser is smaller because there's less inlining?
11:33 <mniip> probably true
11:33 <stiell> When constructors are automatically promoted to types under -XDataKinds, is there any way to "demote" such a type back to its corresponding constructor?
11:33 <Peaker> __monty__, I mean "shrink" as in reject programs that were accepted
11:33 <mniip> a TLB miss *in a process* doesn't happen more often when there's more processes
11:33 <mniip> so my point stands
11:33 <dstolfa> mniip: what do you mean in a process?
11:34 <mniip> when a single thread is executing the TLB is oblivious to any other threasd that exist in the system
11:34 <Peaker> __monty__, s/programs/inputs. This is my 4th attempt maybe to give alex/happy a try. And I'm disappointed each time. I got a contribution of a much-faster alex/happy parser (than the previous parsec parser) which is forcing me to use this
11:34 <mniip> so a fork does not change how "full" the TLB is
11:34 Shogun joined
11:34 <__monty__> stiell: Not sure what you mean but the original type and contstructer you declared still exist.
11:34 <Peaker> I wonder how attoparsec will fare against alex/happy
11:34 bertschneider joined
11:36 <merijn> Peaker: Pretty well if you take care to write an effcient parser
11:36 <dstolfa> mniip: it does though, because you have a working set of pages (each process has their own set of pages), and if they don't fit in the TLB, they'll cause more misses which is much slower
11:36 <cocreature> megaparsec can often also at least get close to attoparsec so you don’t need to give up all the niceties
11:36 <Peaker> merijn, efficient as in not much backtracking?
11:36 <mniip> yes but a fork does not create more pages per process
11:36 <merijn> Peaker: Most of the (potential) slowdown with parser combinators/recursive descent parsers is backtracking. If you can commit to a grammar/parser that avoids backtracking it will be superfast
11:36 <merijn> Peaker: yeah
11:36 <dstolfa> mniip: nono, not per process. did i say that? if so, my bad. i meant it just creates more pages for the OS to deal with
11:36 language_agnosti joined
11:36 <mniip> yes but that in the end does not affect the TLB
11:37 <dstolfa> mniip: it does because you end up with more threads in different address spaces
11:37 dogweather joined
11:39 <stiell> __monty__: e.g. like natVal or symbolVal, but for other types than Integer or String.
11:39 encod3 joined
11:39 <mniip> dstolfa, different address spaces means TLB flush
11:40 <dstolfa> mniip: not a full one, but yes, and forking creates this situation when creating sandboxes that have to interact with eachother (either via some kind of RPC or what have you)
11:41 <dstolfa> so for chrome, if you create 30+ tabs, it'll start conflating sandboxes into a single process simply because the overhead is too significant
11:41 sytherax joined
11:42 <mniip> that sounds like optimizing away context switches
11:42 <mniip> not TLB space
11:42 <dstolfa> mniip: yep, i agree :)
11:43 <dstolfa> mniip: i never said we need more TLB space, just that it'd be a good idea not to use the MMU to implement sandboxing
11:43 xtreak joined
11:43 <dstolfa> but for that you need an architecture which supports it
11:43 <dstolfa> the MMU is great for multitasking and makes unix work the way it does
11:43 <dstolfa> but there are downsides (number of accesses when traversing the page tables is another)
11:43 <dstolfa> especially nested pages
11:44 <* dstolfa> wrote an architectural nested page table walk with interrupts off from scratch and does not want to do it again
11:44 sighingnow joined
11:45 hellozee joined
11:45 remyhr joined
11:49 HarveyPwca joined
11:50 bertschneider joined
11:50 alexteves_ joined
11:50 valentinbuza joined
11:51 saurabhnanda joined
11:52 encod3 joined
11:53 <__monty__> stiell: I think what you're looking for is singletons like in the hasochism paper.
11:53 perspectival joined
11:54 dogweather joined
11:57 <Ariakenom> EWD vs PHK. I read to papers from here that made nice opposites. https://www.cs.utexas.edu/users/EWD/ewd00xx/EWD32.PDF https://queue.acm.org/detail.cfm?id=1814327
11:57 language_agnosti joined
11:58 <Ariakenom> "Some meditations on advanced programming" vs "You're doing it wrong"
11:59 jjmojojjmojo joined
12:00 fmixing joined
12:00 language_agnosti joined
12:01 BalterNotz joined
12:01 <quicksilver> merijn: "anisotropic memory access delay" what a nice choice of adjective
12:01 <quicksilver> this paper is a much more nuanced version of the "O(1) is a myth" that I generally spout
12:03 <BalterNotz> @hoogle
12:03 <lambdabot> package base
12:03 <lambdabot> package bytestring
12:03 <lambdabot> package containers
12:03 oo_miguel joined
12:04 mansalss joined
12:05 <BalterNotz> :> take 5 [1..]
12:06 errst joined
12:06 emilypi joined
12:07 <mniip> quicksilver, your computer is not turing complete
12:07 <mniip> O(-) is a lie
12:08 <adjofun> >quickCheck (\x -> x == x)
12:08 <adjofun> > id x
12:08 <lambdabot> x
12:08 <adjofun> > quickCheck (\x -> x == x)
12:08 <lambdabot> error:
12:08 <lambdabot> • Couldn't match expected type ‘Test.QuickCheck.Random.QCGen’
12:08 <lambdabot> with actual type ‘() -> Bool’
12:10 mkoenig joined
12:10 <lyxia> @check \x -> x == x
12:10 <lambdabot> +++ OK, passed 100 tests.
12:11 bertschneider joined
12:11 <Boomerang> Is that defaulting to () for x?
12:11 <adjofun> oh, that is hoiw it's done. Can someone link me to a list of LambdaBot commands?
12:11 <merijn> quicksilver: Now you too can be lazy and just cite stuff ;)
12:11 <Boomerang> @check \x -> x == (x :: Float)
12:11 <lambdabot> +++ OK, passed 100 tests.
12:11 <Boomerang> No NaN issues then...
12:12 <lyxia> adjofun: you can PM lambdabot with @help and follow the suggestions
12:12 dogweather joined
12:12 <adjofun> lyxia: thanks!
12:13 Rayben joined
12:14 <BalterNotz> @help
12:14 <lambdabot> help <command>. Ask for help for <command>. Try 'list' for all commands
12:14 <BalterNotz> list
12:14 <BalterNotz> @list
12:14 <lambdabot> What module? Try @listmodules for some ideas.
12:14 <BalterNotz> @listmodules
12:14 <lambdabot> activity base bf check compose dice dict djinn dummy elite eval filter free fresh haddock help hoogle instances irc karma localtime metar more oeis offlineRC pl pointful poll pretty quote search
12:14 <lambdabot> slap source spell system tell ticker todo topic type undo unlambda unmtl version where
12:15 Raybin joined
12:15 <lyxia> BalterNotz: /query lambdabot to not spam the channel
12:15 <BalterNotz> ok
12:17 <BalterNotz> hello
12:17 <BalterNotz> ok, bye bye
12:19 davr0s joined
12:19 errst_ joined
12:20 Linter joined
12:21 language_agnosti joined
12:21 Rayben joined
12:23 bno1 joined
12:23 amirpro joined
12:23 agander joined
12:25 amirpro joined
12:25 dogweather joined
12:25 sm joined
12:25 agander_ joined
12:25 BalterNotz joined
12:26 banc joined
12:27 Charn joined
12:27 slaznick joined
12:27 Psybur joined
12:30 tombusby joined
12:31 dodong joined
12:33 benjamin-l joined
12:36 piark_ joined
12:37 AetherWind joined
12:40 cppxor2arr joined
12:40 cppxor2arr left
12:42 dogweather joined
12:42 sm joined
12:42 <__monty__> quicksilver: I haven't heard your spiel about O(1), consider me a willing audience.
12:44 <opqdonut> summary: memory random access is O(log n) because pointer lengths are O(log n)
12:44 <opqdonut> (the standard RAM model in complexity analysis fixes this by assuming that word size is O(log n))
12:45 <Ariakenom> No it's probably about virtual memory. Where it takes O(log n) to walk a tree
12:45 andreabedini joined
12:45 dsh joined
12:45 <opqdonut> that's the practical side of the coin
12:46 <opqdonut> memory hierarchies
12:46 dsh joined
12:46 <Ariakenom> also sqrt n to travel to memory and back for a square shaped memory and n the are which is proportional to amount
12:46 <opqdonut> nice
12:47 <opqdonut> hadn't considered that
12:47 <Ariakenom> :)
12:47 cur8or joined
12:48 remyhr joined
12:48 <mniip> opqdonut, also computers aren't turing complete so truly it makes no sense to talk about "asymptotic" complexity
12:49 arpl joined
12:50 <opqdonut> that's kinda different
12:50 <opqdonut> you can still talk about asymptotic complexity of an algorithm
12:50 <mniip> sure, but not its implementation
12:50 <opqdonut> yeah
12:51 <opqdonut> I guess the trick is that the constant factors tend to be in the same ballpark so you can often cheat by just doing asymptotic analysis
12:51 <mniip> constant factors aren't the problem
12:51 <mniip> it's just that the input size is limited
12:52 <opqdonut> yeah I know what you mean
12:52 <opqdonut> I was just musing about why asymptotic analysis matters
12:52 <mniip> you're effectively only evaluating the algorithm's complexity on [1..a few trillion]
12:52 <opqdonut> in practice
12:52 <mniip> consider e.g Furer's algorithm for integer multiplication
12:53 <opqdonut> yeah or the bleeding edge matrix multiplication things
12:53 <* hackage> shake-cabal 0.1.0.1 - Shake library for use with cabal http://hackage.haskell.org/package/shake-cabal-0.1.0.1 (vmchale)
12:53 progfun joined
12:53 <opqdonut> https://rjlipton.wordpress.com/2010/10/23/galactic-algorithms/
12:53 <mniip> you *cannot* see a performance improvement over Schonhage-Strassen if your pointer size is constant
12:53 <opqdonut> right
12:53 <opqdonut> yeah that's even more subtle
12:54 <Ariakenom> Random bignum link: https://gmplib.org/
12:55 borkr joined
12:56 freeman42x]NixOS joined
12:57 <mniip> iirc SS is the "last" backend that libgmp uses
12:57 freeman42x]NixOS joined
12:57 <mniip> for numbers with multiple tens of thousands of digits
12:57 <adjofun> offtopic, while I see GMP: can someone explain to me why where is no primops for integer^integer? GMP suports that iirc, and that could bring to `scientific` *reeeeeally* arbitrary precision numbers
12:57 mcspud joined
12:57 shafox joined
12:58 <adjofun> someone already kicked the author of `scientific` because it is used in aeson, and someone in production already got to limit of Integer^Int, and it broke their code
12:58 dhil joined
12:59 matsurago joined
12:59 dogweather joined
12:59 <mniip> adjofun, GMP supports what?
12:59 danthemyth joined
12:59 sigma_ joined
12:59 <mniip> I see mpz_powm whish is modular exponentiation and mpz_pow_ui which has an int32 exponent
12:59 BalterNotz joined
12:59 duoi joined
13:00 <mniip> sorry uint64 exponent
13:00 zakora joined
13:00 <sigma_> is atomically function from STM module is an example of monad transformer ?? because atomically :: STM a -> IO a
13:00 <adjofun> mniip: bignum exponentiation is not a thing in GMP, you saying?
13:00 lektrik joined
13:00 <Ariakenom> https://gmplib.org/manual/Multiplication-Algorithms.html#Multiplication-Algorithms
13:00 <adjofun> sigma_: it is an example of natural transformation, rather
13:00 psychicist__ joined
13:01 <mniip> Ariakenom, ah my bad, just plain FFT
13:01 <* hackage> distributed-process-client-server 0.2.5 - The Cloud Haskell Application Platform http://hackage.haskell.org/package/distributed-process-client-server-0.2.5 (AlexanderVershilov)
13:01 <Ariakenom> "At large to very large sizes a Fermat style FFT multiplication is used, following Schönhage and Strassen "
13:01 <lyxia> sigma_: that's not a monad transformer.
13:01 <sigma_> adjofun : what's the difference ?
13:01 <mniip> adjofun, the ^^ in Prelude is of similar complexity to the best algorithm known to me
13:01 <Ariakenom> mniip: I linked GMP because i remembered Schönhage and Strassen from GMP
13:02 <adjofun> mniip: it is not about complexity, it is about arbitrary precision in `scientific`
13:02 BalterNotz joined
13:02 <mniip> well-uh, use ^^
13:03 <adjofun> mniip: aeson uses Scientific for JSON Number, I willl link an issue
13:03 <mniip> sigma_, a monad transformer is a type of kind (* -> *) -> * -> *
13:04 <mniip> in general, T is a monad transformer when for any Monad m, T m is a Monad
13:04 AetherWind joined
13:04 <mniip> usually T "adds" some features onto m
13:05 xqb16141 joined
13:05 <mniip> in that T's >>= uses m's >>= internally somehow, but also has extra logic of its own
13:05 danso joined
13:05 keepLearning512 joined
13:05 <sigma_> mniip : how it's done than going from STM to IO because (>>=) restrict that right "m a -> (a -> m b) -> m b"
13:06 <mniip> ?
13:06 <mniip> not sure what you're asking
13:07 Folkol joined
13:08 youtmon joined
13:08 <__monty__> :t listToMaybe
13:08 <lambdabot> [a] -> Maybe a
13:08 <__monty__> sigma_: ^ not a monad transformer.
13:08 <adjofun> mniip: I remembered an issue incorrectly, someone in prodiction got hit by divergence of Fractional instance of Scientific. But there is an open issue for Integer^Integer: https://github.com/basvandijk/scientific/issues/62
13:08 LKoen joined
13:09 language_agnosti joined
13:10 <adjofun> sigma_: Natural transformation is a morphism with type m a -> n a. As examples, `listToMaybe` and `atomically` are natural transformations. Think of them as context transformations.
13:10 BalterNotz joined
13:10 <dminuoso> sigma_: Generally if you have some `(Functor f1, Functor f2) => f1 a -> f2 a`, assuming it obeys some laws, natural transformation.
13:10 potatoe_ joined
13:11 progfun joined
13:11 <Ariakenom> mniip: Did you see that GMP's last algo was indeed Schönhage and Strassen?
13:11 <adjofun> sigma_: Regarding monads: Monad is a functor with two natural transformations, pure :: a -> m a, and join :: m (m a) -> m a
13:11 <mniip> there's a difference
13:11 camsbury joined
13:11 <mniip> between "FFT according to Schonhage and Strassen" and "Schonhage-Strassen algorithm"
13:12 BalterNotz joined
13:12 <sigma_> adjofun : okay.. makes sense thank you.
13:12 <dstolfa> adjofun: it's not a functor, it's an adjunction, i.e. two adjoint functors
13:12 <mniip> the latter actually makes an improvement by picking the base as a power of two
13:12 <mniip> and then I think there's some recursion regarding the finite field operations
13:12 <malice> I've got a question: I'm following this tutorial: https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/Evaluation,_Part_2
13:12 <malice> specifically, I'm at implementing eqv
13:12 <dminuoso> dstolfa: it is a functor.
13:13 <dstolfa> dminuoso: it's an ENDOFUNCTOR :)
13:13 BalterNo1z joined
13:13 <dminuoso> dstolfa: Because Functor f => Functor (f :.: f)
13:13 <sigma_> anyone aware of some good resources on monad transformers and readerT and readerT pattern specifically please share
13:13 <dminuoso> Oh well!
13:13 <malice> This is a binary operation; however, there is some redundancy in the code
13:13 <adjofun> dstolfa: my category-theory-foo is weak, sadly =\
13:13 <malice> e.g. specialization for Number and for Bool look the same
13:13 BalterNotz joined
13:13 jinzhao joined
13:13 <malice> is there a way to write the first four clauses as one?
13:13 <jinzhao> hello
13:13 language_agnosti joined
13:13 <mniip> dstolfa, is there a definition of a monad that dos not require an endofunctor?
13:14 <BalterNotz> 你好 jinzhao
13:14 <dstolfa> mniip: hmm
13:14 <mniip> unless you mean we get an endofunctor by composing the two sides of the adjoint
13:14 potatoe_ joined
13:14 <dstolfa> mniip: good question, i mean, an adjunction can be defined in terms of adjoint functors i.e. L for left-adjoint and R for right-adjoint with a natural transformation between them
13:14 <dstolfa> so you don't explicitly say "endofunctor" but yeah
13:15 <mniip> in an adjoint neither L nor R are endo
13:15 <dstolfa> yeah
13:15 <dstolfa> but LR gets you back
13:15 <mniip> are you saying every endofunctor is splittable into an adjunction?
13:15 <dstolfa> you could say it's an adjunction with 2 natural transformations being the unit and counit
13:15 <dminuoso> (F -| G) => Monad G :.: F
13:16 <dminuoso> Is there actually a typeclass to express adjunction?
13:16 <* dminuoso> checks edwards repositories
13:16 <mniip> I remember seeing that
13:16 <dminuoso> https://hackage.haskell.org/package/adjunctions-4.4/docs/Control-Monad-Trans-Adjoint.html mmm
13:17 <dminuoso> What is AdjointT :o
13:17 <Taneb> http://hackage.haskell.org/package/adjunctions-4.4/docs/Data-Functor-Adjunction.html
13:17 <mniip> f (w (g a)) pretty much
13:17 <mniip> that's a comonad transformer though
13:17 language_agnosti joined
13:17 keepLearning512 joined
13:19 AndreasPK_ joined
13:19 tsaka__ joined
13:19 Peaker joined
13:20 <mniip> I'm going to conjecture Maybe(X) = 1 + X does not decompose into an adjunction
13:21 <mniip> coproducts only pop up to the left of adjunctions while units only to the right
13:21 ru0mad joined
13:22 <Taneb> My copy of Categories for the WOrking Mathematician has just arrived! \o/
13:22 cur8or joined
13:22 <adjofun> Taneb: congrats, now you will know how deep the rabbit hole goes =:)
13:23 <mniip> Taneb strikes me as the type of person to having already known that
13:23 <Taneb> adjofun: oh, I've already done a bit of diving in
13:23 language_agnosti joined
13:23 <Taneb> This is me trying to reinforce the walls of my rabbit hole
13:24 <Ariakenom> So that they can take a strung gust.
13:24 <dstolfa> Taneb: i like ct4s by spivak as well :)
13:25 carlomagno joined
13:25 <__monty__> malice: No, you can't have a variable/wildcard match a constructor only a value.
13:25 rblaze joined
13:26 <malice> too bad
13:26 <Taneb> dstolfa: I've also been recommended CT by Awodey
13:27 <Taneb> And when I was at university I enjoyed Categories by Schubert, but that's hard to get ahold of
13:27 zariuq joined
13:27 <__monty__> malice: You can factor out the bodies of the four clauses though. Or if you had for example Expr Bool arg1, Expr Number arg1, etc. then you could treat those four clauses in a single definition.
13:29 <__monty__> malice: Would be something like eqv [(Expr a arg1), (Expr b arg2)] | a == b = return $ Expr Bool $ arg1 == arg2
13:30 <malice> well, Bool, Number etc. are of LispVal data type
13:31 <malice> but that won't help, I guess
13:31 saurabhn_ joined
13:32 <Psybur> @hoogle These (f a) (f a) -> f (These a a)
13:32 <lambdabot> Data.These mapThis :: (a -> c) -> These a b -> These c b
13:32 <lambdabot> Data.These mapThat :: (b -> d) -> These a b -> These a d
13:32 <lambdabot> Data.Align align :: Align f => f a -> f b -> f (These a b)
13:33 ystael joined
13:33 dogweather joined
13:33 iAmerikan joined
13:34 chaosmasttter joined
13:34 pie_ joined
13:36 <__monty__> malice: The second solution would imply you scrap those constructors and make a new one whose first parameter would be an enum of the four things you just scrapped. Sure that refactoring may be involved but it's possible in principle, just depends how motivated you are to reduce the number of cases in eqv ; )
13:36 benjaminfranklin joined
13:36 <dminuoso> Can I command stack to preinstall a resolver?
13:37 <Taneb> Psybur: the obvious thing there I think needs a Monad constraint
13:37 <dminuoso> (Preferrably without some fake project)
13:37 <Taneb> Or... no
13:37 <Taneb> I'm completely wrong here
13:37 <dmwit> Applicative should be enough.
13:38 <Taneb> Yeah, I completely misread it
13:38 <__monty__> malice: I'd probably just factor out the body of the clauses but you might not want the auxiliary function poluting the top level.
13:38 <dmwit> Psybur: If it has a Bitraversable instance, `bitraverse` can be given that type (with the `Applicative` constraint).
13:39 <dmwit> Psybur: Yay, the haddocks say it does have the appropriate instance!
13:39 <dmwit> Sorry, I mean bisequenceA, obviously.
13:42 raingloom joined
13:43 language_agnosti joined
13:43 amirpro joined
13:46 crobbins joined
13:46 <* hackage> ats-storable 0.3.0.5 - Marshal ATS types into Haskell http://hackage.haskell.org/package/ats-storable-0.3.0.5 (vmchale)
13:46 djtyml joined
13:47 youtmon joined
13:47 trevorriles joined
13:48 Patternmaster joined
13:48 ozataman joined
13:50 carlomazzaferro joined
13:50 knupfer joined
13:50 deepfire` joined
13:50 rblaze joined
13:53 plugin joined
13:55 dogweather joined
13:57 <Psybur> Thanks
13:57 pagnol joined
13:57 Sampuka joined
13:59 osa1 joined
14:00 _vaibhavingale_ left
14:00 w3b573r joined
14:04 ddellacosta joined
14:04 amelliaa joined
14:07 potatoe_ joined
14:09 BalterNotz joined
14:11 adjofun joined
14:12 dogweather joined
14:14 acidjnk joined
14:15 w3b573r left
14:15 zar joined
14:16 hackebeilchen joined
14:19 eschnett joined
14:19 enterprisey joined
14:23 tsoernes joined
14:25 Sose joined
14:25 elfets joined
14:28 arkaros joined
14:29 dogweather joined
14:29 Guest92 joined
14:34 danthemyth joined
14:37 darkJedi joined
14:38 <ddellacosta> I was reading Justin Le's post on lenses and prisms (https://blog.jle.im/entry/lenses-products-prisms-sums.html) yesterday, and I got confused by one thing he brought up--the isomorphism between NonEmpty a and (a, [a]). Is there a way to express this in actual Haskell code? I don't know what `<~>` is, other than that it's expressing that isomorphism somehow
14:39 <* hackage> distributed-process-client-server 0.2.5.1 - The Cloud Haskell Application Platform http://hackage.haskell.org/package/distributed-process-client-server-0.2.5.1 (AlexanderVershilov)
14:39 <darkJedi> Hi! What does ```let fibs = 1:1:(zipWith (+) fibs (tail fibs))```
14:40 <darkJedi> What does the expression mean over here ?
14:40 khilan joined
14:40 <darkJedi> I understood zipWith with it's type signatures
14:40 <adjofun> @let fibs = 1:1:(zipWith (+) fibs (tail fibs))
14:40 <lambdabot> Defined.
14:40 <adjofun> > take 10 fibs
14:40 <darkJedi> But what does 1:1: mean over here
14:40 <lambdabot> [1,1,2,3,5,8,13,21,34,55]
14:40 Maxdamantus joined
14:40 <Cale> It defines fibs to be the list which starts with two 1's and then continues with the elementwise sum of itself with its own tail
14:41 <darkJedi> Oh! Thanks
14:41 <darkJedi> This is probably the shortest fibonacci code that I ever saw.
14:41 <darkJedi> :)
14:42 dogweather joined
14:42 alx741_ joined
14:43 Boomerang joined
14:44 <Cale> > fix ((0:) . scanl (+) 1)
14:44 <lambdabot> [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,...
14:44 <Cale> darkJedi: ^^ there's another one to puzzle over :)
14:45 <darkJedi> hi I had one more doubt. https://lpaste.net/6426402858828038144
14:45 language_agnosti joined
14:45 <darkJedi> I tried to understand the type inference of cons.
14:45 lonokhov joined
14:45 <Cale> :t (:)
14:45 <lambdabot> a -> [a] -> [a]
14:45 <Cale> ^^ this might be more helpful :)
14:46 <darkJedi> What does ... mean in ```data [] a = ... | a : [a]```
14:46 <darkJedi> ?
14:46 <Cale> That's actually pseudocode, since the type of lists has built-in syntax, but what's meant is that : is one of its data constructors
14:47 <adjofun> darkJedi: Where are you even took that example?
14:47 <Cale> adjofun: From :i in ghci
14:47 <adjofun> huh
14:47 <darkJedi> @adjofun :i from ghci
14:47 <lambdabot> Unknown command, try @list
14:48 <Cale> https://downloads.haskell.org/~ghc/latest/docs/html/libraries/ghc-prim-0.5.2.0/src/GHC.Types.html#line-98
14:48 <darkJedi> :Cale Thanks
14:48 son0p joined
14:48 <Cale> It's funny that they can even really get away with that definition
14:48 <adjofun> darkJedi: So, define `data MyList a = MyNil | MyCons a (MyList a)`
14:48 Luke joined
14:49 <Cale> Yeah, you can imagine that if you'd defined something like adjofun's definition, and did :i MyCons
14:49 <Cale> it would show you something like data MyList a = ... | MyCons a (MyList a)
14:49 <darkJedi> :adjofun Thanks I will try it right away.
14:50 <jbetz> https://github.com/alasconnect/auth0 <-- how would I use `ghcid` in a project like this? nix-shell doesn't have the `auth0` library package, so that doesn't work, but I'd think it'd be easy to add it, I just don't know how.
14:51 <jbetz> "that" being `ghcid --command="ghci test/Main.hs" inside the nix-shell
14:51 Linter joined
14:52 earthy joined
14:52 zaquest joined
14:53 chessai joined
14:54 dogweather joined
14:55 roconnor joined
14:57 <jbetz> `ghcid -c="cabal new-repl lib:auth0"` <-- okay, got it working with this :)
14:58 <Cale> hmm
14:59 saurabhnanda joined
14:59 slaznick left
15:00 solaire joined
15:00 inad922 joined
15:01 Rayben joined
15:03 saurabhn_ joined
15:03 kmurphy4 joined
15:05 language_agnosti joined
15:07 dogweather joined
15:07 ralu joined
15:08 MufeedAli[m] joined
15:09 jophish joined
15:10 <quicksilver> opqdonut and Ariakenom not only accurate summarised my O(1) rant but they did so more accurately and coherently than I would have. IRC ftw.
15:11 DSM joined
15:11 skeet70 joined
15:13 <Ariakenom> woop!
15:13 Deide joined
15:14 cosmia joined
15:15 <Cale> jbetz: I'd kind of expect that you'd want to add something for the native auth0 library to an extraPackages argument to mkDerivation in packages.nix, however, I'm not sure where to get that :)
15:16 <Cale> assuming it's a missing native build input? :)
15:16 <Ariakenom> Hm. More coherently. So quicksilver would have argued more than 2 views at once?
15:16 <Cale> Maybe I'm misunderstanding what's going wrong though
15:18 codesoup joined
15:19 knupfer joined
15:19 agander joined
15:19 <Cale> jbetz: oh, I see what you mean -- you want a nix-shell with *your* auth0 library built
15:19 <jbetz> Cale: exactly
15:20 <jbetz> and `new-repl` gives me that, so I don't think I need to mess with the derivation at all
15:21 <jbetz> which is nice
15:22 <quicksilver> Ariakenom: frequently, yes.
15:22 <quicksilver> Ariakenom: I am both incoherent and overlapping. Often also undecidable.
15:22 <maerwald> Installing Stack to: /usr/local/bin/stack -- wth
15:22 <Ariakenom> Sounds pragmatic
15:23 <maerwald> ah, it supports --dest=, but ofc doesn't provide --help
15:23 <maerwald> very pragmatic
15:23 <Cale> jbetz: seems fair enough. There is a way to do it just with nix, but it would require a bit more editing.
15:24 <tdammers> stackmatic
15:24 <Ariakenom> bad timing. I was talking about quicksilver
15:24 <tdammers> fitting nonetheless :)
15:25 dogweather joined
15:26 Rayben joined
15:27 <maerwald> and the installer doesn't support my linux distribution :>
15:27 <maerwald> I guess I also have to switch distro to use it
15:27 <maerwald> so exciting
15:28 <tdammers> which distro would that be?
15:28 <maerwald> emacs
15:29 <tdammers> D:
15:29 <adjofun> vim is my favourite OS =:)
15:29 urodna joined
15:30 matsurago joined
15:30 beefjoe joined
15:30 <maerwald> does ghc-mod even support stack?
15:31 kmelva joined
15:31 <gentauro> Question, isn't the SAFE language Pragma pretty much useless? :) -> https://gitlab.com/snippets/1724709
15:31 <dminuoso> maerwald: Yes but the current lts is not supported afaik.
15:31 hellozee joined
15:31 <gentauro> I would like to hear why my table isn't the way it should have been done :)
15:31 canaria joined
15:31 reactormonk joined
15:32 <dminuoso> It works up to 9.22 (or whatever the latest 9.xx is) I believe. Though there are some not-yet-released patches for newer versions
15:32 alex`` joined
15:32 FreeBirdLjj joined
15:32 <geekosaur> gentauro, Trustworthy means you are asserting that you know the uses of e.g. unsafePerformIO have been vetted and won't cause problems
15:32 <glguy> gentauro: The point of Trustworthy modules is that you're asserting that the module, while internally unsafe, exports a safe public API and should be OK to import into safe modules
15:32 <gentauro> and that is a fair point
15:32 <glguy> and then at a package level users of the package get to decide if they want to honor your trustworthy assertions
15:33 enterprisey joined
15:33 DSM joined
15:33 <gentauro> but how can a module calling something Trustworthy become safe?
15:33 <glguy> Because you decide whether to accept trustworthy modules at the package level
15:33 <gentauro> I mean, I would accept that you bubbled up the Trustworthyness, but not convert it
15:33 <gentauro> glguy: yes, and that would at most make my library Trustworthy, not SAFE
15:33 <glguy> no
15:34 weird_error joined
15:34 <gentauro> but it's possible as I show in my code, to make my app SAFE while it isn't ...
15:34 <glguy> The point of trustworthy modules is that they are intended to be imported by safe modules without futher verification
15:34 <glguy> once you're satisfied with the trustworthy modules not being dangerous it's OK to import them without further checks into a safe module
15:34 <gentauro> glguy: and that's is my point why I say that SAFE is pretty much useless :)
15:34 <glguy> then you're missing the point of you have to manually choose whether or not to accept trustworthy modules
15:35 <geekosaur> "Trustworthy" = asserted, "Safe" = inferred. And you're assuming a different threat model than Safe Haskell is designed for; the docs and original paper go over that part
15:35 <glguy> you can toggle your trust in a package with the ghc-pkg tool
15:35 oisdk joined
15:35 <geekosaur> in particular, it is explicitly *not* a security model in the usual sense
15:36 <gentauro> glguy: yes, I'm able to remove all trust (even base) but code like the provided go smoothly through ...
15:36 <geekosaur> it's a *purity* model
15:36 <gentauro> :|
15:36 <gentauro> it's none of the above. It's a false safety "something"
15:36 <geekosaur> no
15:36 <glguy> gentauro: You lied to yourself and said that NotReallySafe was safe and then object when it wasn't?
15:36 <geekosaur> that's deciding the model you want is the only valid model
15:37 <gentauro> I would compare it to redirecting your HTTP calls to HTTPS with a JavaScript instead of disabling HTTP on server level
15:37 <glguy> then you'll need to reread the paper
15:38 <maerwald> Bootstrapping stack project environment failed -- lol
15:38 <glguy> maerwald: Have you tried stack?
15:38 <maerwald> :>
15:38 pio_ joined
15:38 <gentauro> glguy: probably, but I'm also probably not going to go away from my analogi of SAFE pragma = HTTP to HTTPS redirect with JS
15:39 <glguy> ok, sounds good
15:40 language_agnosti joined
15:42 dogweather joined
15:43 sbrg joined
15:43 sbrg joined
15:48 Rayben joined
15:49 <* hackage> observable 0.1.0 - Make your action to be observable and listen events from them. http://hackage.haskell.org/package/observable-0.1.0 (iokasimovmt)
15:49 Raybin joined
15:50 arpl left
15:50 <maerwald> ~/.stack/config.yaml: Unrecognized field in ConfigMonoid: resolver
15:55 <maerwald> https://docs.haskellstack.org/en/stable/yaml_configuration/#resolver
15:55 <maerwald> am I reading something wrong?
15:59 <gentauro> glguy: I might have another question
16:00 darkJedi joined
16:01 dogweather joined
16:01 <gentauro> glguy: If I make a stack script and include a Trustworthy package (ex: http-client-tls), if I mark the script as SAFE, it will actually fail: https://gitlab.com/spisemisu/cleanse-facebook/blob/master/CFB.hs#L17-29
16:01 trevorriles joined
16:01 <gentauro> is there something "built-in" to Stack that doesn't allow the Trustworthy propagation to SAFE (this is actually what I'm looking for)
16:01 <glguy> packages can't be Trustworthy
16:01 <Psybur> @glguy, remember all that hubbub I was making about merging alternatives? Data.These and Data.Align are doing the trick
16:01 <lambdabot> Unknown command, try @list
16:02 <gentauro> but I don't seem to be able to do it "manually" with "ghc"
16:02 codesoup joined
16:02 <glguy> gentauro: When you mark a package "trusted" you're saying that that package's Trustworth annotations on modules should be honored
16:04 <gentauro> so a simple "ghc -o foo *.o" linking, shouldn't be doing that right?
16:04 <glguy> depnds on what's set in your package database
16:05 <gentauro> my *.o are just local modules I have pre-built. For example: ghc -Wall -Werror -O3 -c Wrapper.hs -o wrapper.o
16:05 jfredett joined
16:06 KeyJoo joined
16:07 jfredett joined
16:08 keepLearning512 joined
16:08 djbeau joined
16:08 Rayben joined
16:09 <gentauro> so I think I begin to get it. SAFE pragmas only work on packages (handled by ghc-pkg)
16:09 inkbottle joined
16:09 <* hackage> distributed-process-supervisor 0.2.1 - Supervisors for The Cloud Haskell Application Platform http://hackage.haskell.org/package/distributed-process-supervisor-0.2.1 (AlexanderVershilov)
16:10 <gentauro> so in case I want to enforce safeness, the same way Stack does it, I will have to register my local modules as packages with ghc-pkg ... I will give that a try
16:10 <geekosaur> you were expecting ghc to somehow hook into the guts of the system linker?
16:10 <geekosaur> did you also expect it to hook the kernel?
16:10 <gentauro> geekosaur: when I linke an Unsafe pkg to a Safe app, it crashes (as expected)
16:11 <geekosaur> when you have packqages at ghc level yes
16:11 va3vna joined
16:11 <gentauro> that's why I don't really got the grasp of why it will allow to link Trustworthy to Safe. But I can see that it's designed like this
16:12 <geekosaur> yes of course ghc should implent its own linker. like they're trying to get aaway from because that doesn;t work on ARM, that gets into trouble on OS X, it means chasing OSes that are constantly changing the rules
16:12 <gentauro> and that's also what I'm pointing out with my table of what actually give sense
16:13 lambda-11235 joined
16:13 crobbins joined
16:16 bbrodriguez joined
16:17 gregberns joined
16:17 <inkbottle> With elementary arithmetic evaluator state monad counting the 'div', I fail to find the equality in first formula there: http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf#page=12 (section 2.3 is to be read section 2.8, BTW)
16:17 danthemyth joined
16:17 <inkbottle> (State (s -> ((), s+1)) >> return 3 =?= return 3 >> State (s -> ((), s+1))
16:17 thunderrd joined
16:19 skeuomorf joined
16:19 vurtz joined
16:19 obi_jan_kenobi__ joined
16:20 martinmch left
16:22 ZeuPiark joined
16:22 Linter joined
16:23 <nshepper1> gentauro: it sounds like you want to -trust http-client-tls in your stack script?
16:24 <infinisil> Hey, I made myself a monad which does IRC actions, e.g. `replyPriv :: Text -> m ()`, now to actually run this, I'll need to pass it an input message
16:25 <infinisil> I mean to run the Monad, because i wanna reply to a certain message
16:26 <infinisil> What I can do I think is this: `instance IRCMonad (ReaderT InputMessage m) where`
16:26 ozzymcduff joined
16:26 <infinisil> Then I should be able to run it by doing runReaderT action inputMessage
16:26 <nshepper1> gentauro: that way the import of Network.HTTP.Client into your Safe modules should be ok
16:26 <infinisil> Is that how you're supposed to do this? Or am I missing something?
16:27 <nshepper1> but i've never really tried using SafeHaskell before
16:28 <gentauro> nshepper1: not really
16:29 <gentauro> I want to pass some functionallity with IO (get / post) to a safe submodule
16:29 <glguy> nshepper1: No, the one module that that package exports is not Trustworthy or Safe
16:30 <gentauro> that way, when I executed your code, I would have a certenty that the only IO you could perform would be to use my logic
16:31 <gentauro> my problem is that I'm assuming that your are nice and will provide me with some SAFE code (my goal is to accept binary)
16:31 <gentauro> but the GHC don't really helps me
16:32 <gentauro> well it helps me when you provide me with an Unsafe .o file
16:32 <glguy> gentauro: To restrict the IO that a Safe module can do, you'd make a new type and operations on that type that you want to allow, Then the restricted module can be required to export a value of that type that your outer program might be willing to convert to IO and execute
16:32 <gentauro> then GHC doesn't want to link Safe .o with Unsafe .o (ME GUSTA)
16:32 <glguy> you generally shouldn't be manually linking o files
16:33 <gentauro> but if you provide me with a "nasty" .o marked as Trustworthy, GHC will "eat it raw" an say "It's fine, lets link this stuff"
16:33 <gentauro> my general problem is that I assumed that Safe/Unsafe/Trustworthy was implemented in a "sound" way, but it seems that it isn't and is just trying to "forward HTTP to HTTPS with some JavaScript" :'(
16:34 <nshepperd> exactly what kind of certainty are you looking for?
16:34 <glguy> You're circumventing the system
16:34 <maerwald> sad, intero-neovim seems buggy even with stack
16:34 <nshepperd> security? that's impossible, I can put arbitrary code in a .o file and mark it any way I want
16:34 <gentauro> nshepperd: I would accept that if you provide me with a Trustworthy .o, I would it at least have to mark my module as Trustworthy
16:35 <glguy> gentauro: then you're still missing the point
16:35 <geekosaur> gentauro has one security model. it is the only conceivable security model, and therefore this must conform to it
16:35 stux|RC-- joined
16:35 <nshepperd> you should load source code
16:35 <gentauro> nshepperd: this is what I'm able to do now
16:35 <ZeuPiark> hello
16:35 <gentauro> but I'm thinking of people having some IP that they don't wan to share (and that is fair enough)
16:36 <gentauro> but if the problem is that you can't never trust any .o file and the compiler can't help you, then I will just rely on code
16:36 sbrg joined
16:36 sbrg joined
16:36 <geekosaur> it's not just the compiler you need checking
16:36 <geekosaur> it's the system linker
16:36 <geekosaur> it's the kernel
16:37 <geekosaur> it's libc
16:37 <geekosaur> or, yes, you do it yourself and make sure you've covered all bases, and there's no way that the kernel that isn;t following your threat model can do its own thing instead of yours
16:37 <geekosaur> or libc or etc.
16:38 <nshepperd> for all practical purposes, verifying a .o file does or doesn't do anything in particular is impossible
16:38 <gentauro> nshepperd: how is ghc able to not allow linking Unsafe / Safe .o together?
16:38 <gentauro> I mean, there must be a feature for this right?
16:39 <geekosaur> it only does so when it is using the package database and its annotations
16:39 <glguy> No, you aren't meant to use Safe Haskell at the object file level like this
16:39 <geekosaur> linking .o files does not use the package database
16:39 <geekosaur> it uses the system linker
16:39 <geekosaur> I ask again: do you expect ghc to patch the system linker to do its will?
16:39 <habbah> how do you test api endpoints with hspec?
16:40 <gentauro> geekosaur: what do I know? That's why I'm asking
16:40 <habbah> how do others here test api endpoints?
16:40 <geekosaur> and that's why I'm asnwering, and why glguy is answering
16:40 <geekosaur> but you keep rejecting those answers
16:40 <geekosaur> you want to hear something else
16:40 penteract joined
16:40 enterprisey joined
16:40 <gentauro> geekosaur: it's actually not the likner
16:41 <geekosaur> you say you don't know, but you can also say that
16:41 <nshepperd> even if there is such a thing as a 'Safe .o file' (it sounds like geekosaur is saying there is not), it would just be a flag set somewhere in the file asserting that when ghc built the file it verified that the source was Safe
16:41 <gentauro> linker (sorry). it's ghc when it tries to compile and I'm pointing to the .o file
16:41 <nshepperd> it would be trivial to set that same flag on any file
16:41 <shapr> silly question, how do I get the max value for the ID column from persistent?
16:42 <geekosaur> gentauro, you really do not know how this works. ghc cannot "compile" a .o file. and ghc cant even sensibly rerad it to see your magic unalterable safe/unsafe annotation
16:42 <geekosaur> ghc passes .o files to the system linker, ghc generates a .o file when given a .hs file and then passes that to the system linker
16:42 <shapr> I get an uploaded file, and I want it to have a unique name, is there a better way than using the max id value for the matching db row for uploaded form data?
16:42 stux|RC joined
16:42 <nshepperd> if people want to avoid sharing some IP, they should probably either not submit it or run the code through some kind of source-to-source obfuscator that preserves Safeness
16:43 <geekosaur> if you link in a package, it consults its package database to see (in this case) if it is safe, tne retrieves the package databse's information on .o/.so/.a/whatever and passes that to the system linker
16:43 <dminuoso> shapr: Use GUIDs and a unique constraint.
16:44 <shapr> unique constraint?
16:44 <shapr> guid is a good idea!
16:44 oisdk joined
16:45 <dminuoso> shapr: If it needs to be unique, additionally enforce it with a unique constraint in the database. Surely persistent must have some interface for that.
16:45 kritzefitz joined
16:45 <shapr> oh good point
16:45 <shapr> dminuoso: that solves the whole thing, thanks!
16:45 <gentauro> nshepperd: I just built the module both as Unsafe and TrustWorthy and diffed them
16:46 <gentauro> not difference between them :|
16:46 <geekosaur> it's in the package registry, as you've been told multiple times
16:48 <gentauro> geekosaur: where? I mean, executing -> ghc-pkg list show none of my local modules ...
16:48 <geekosaur> correct because they are not packages
16:48 <geekosaur> which you were also told multiple times
16:49 <geekosaur> yu keep insisting that what you are being told is wrong because it's not what you want to believe is actually happening
16:49 <geekosaur> which does not change what is actually happening to what you prefer to believe
16:50 <gentauro> geekosaur: forget
16:50 <gentauro> forget it
16:50 <geekosaur> what you want to have happen cannot be done by ghc
16:50 <geekosaur> or by gcc
16:50 <geekosaur> or by any other compiler
16:50 <nshepperd> where the annotation is doesn't really matter anyway
16:50 arkadefr joined
16:51 <nshepperd> the only way to verify a module is Safe is to compile it yourself
16:51 <geekosaur> it needs to be in the kernel, it needs to be supported by the entire system toolchain
16:51 <nshepperd> if you're accepting a module someone else compiled, you can't verify it
16:52 <gentauro> nshepperd: "if you're accepting a module someone else compiled, you can't verify it" got it
16:52 <gentauro> so no accept of others .o file. Give me the code or no show
16:52 <gentauro> thx
16:52 <geekosaur> pretty much, yes
16:52 <nshepperd> yep
16:52 <geekosaur> you get no guarantees anywhere. this kind of thing is *hard*
16:53 <geekosaur> (and you're still vulnerable to someone replacing key things. like the compiler or the linker.)
16:53 <geekosaur> @google reflections on trusting trust
16:53 <lambdabot> https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf
16:55 dogweather joined
16:56 keepLearning512 joined
16:58 pie_ joined
16:59 <nshepperd> there /are/ forms of cryptographic wizardry ('Secure multi-party computation' protocols) that could in theory accomplish this, but they're a long way off from being remotely practical especially on something as complex as ghc
17:02 conal_ joined
17:02 desperek joined
17:03 avn joined
17:04 <dminuoso> geekosaur: This is one of the reasons why Linus only compiles his own kernel from his own git repo. =)
17:04 Pickles1 joined
17:04 ubu_ joined
17:05 <liste> that doesn't save him from tainted compilers though
17:05 <liste> or tainted linkers
17:05 <geekosaur> ^
17:05 pounce joined
17:06 enterprisey joined
17:06 <dminuoso> liste: In a way it's scary because tainted hardware is *much* harder to prove. It's not reasonable to look at a modern DIE with an electron microscope and have any idea how it works, and whether in between the billions of transistors produced by the most propriertary HDL code on this planet have some kind taint.
17:07 kapil___ joined
17:07 Gurkenglas joined
17:07 dogweather joined
17:08 <nshepperd_> I mean, "someone has already installed malware in my machine" is a very different threat model to "someone sent me a program, i want to check that it's not malware"
17:08 <geekosaur> dminuoso, dont forget things like hacked usb firmware
17:09 <* geekosaur> … is not a security expert. but knows far too much for comfort, even so
17:09 plugin_ joined
17:10 t7 joined
17:12 <dminuoso> geekosaur: I was really scared to learn how easy it is to ring escalate if you have hardware access.
17:12 <geekosaur> yep
17:12 <dminuoso> There's OTS PCI cards with an usb plug you can use to directly probe memory, its scary.
17:12 Pickles1 left
17:12 <dminuoso> And its not like they employ any hacks, this feature is basically in the design.
17:14 JimmyRcom_ joined
17:14 replay joined
17:15 quobo joined
17:15 keepLearning512 joined
17:15 RegEchse joined
17:16 shannow_ joined
17:16 takuan joined
17:17 t8 joined
17:18 nyberg joined
17:20 astrofog joined
17:20 dogweather joined
17:22 kefin_ joined
17:22 wollw joined
17:25 weird_error joined
17:25 forell joined
17:26 t7 joined
17:27 plugin joined
17:30 Khisanth joined
17:32 <infinisil> What's the difference between `type Foo m :: *` and `type Foo m :: *` in a typeclass?
17:32 <infinisil> Um, I mean `type Foo m :: *` and `data Foo m :: *`
17:32 <cocreature> infinisil: data families create new types, type families resolve to existing types
17:33 Luke joined
17:33 <infinisil> Hmm, okay then I think I want `type` in my case. It's a class that represents something that can provide an input of a specific type
17:35 davr0s joined
17:35 plugin joined
17:35 keepLearning512 joined
17:35 rihards joined
17:36 wildlander joined
17:37 dpyro joined
17:38 <infinisil> Wow, I feel like a pro, I was able to use the "~" thing for once
17:39 <* cocreature> hands infinisil their Haskell-pro badge
17:40 raichoo joined
17:42 dogweather joined
17:43 <edmundnoble> Oooh show it
17:44 <infinisil> The ~?
17:48 <koala_man> nice. I still haven't done that ^^
17:51 ircd joined
17:52 ski joined
17:53 keegans joined
17:54 fmixing joined
17:55 mariatsji joined
17:55 conal_ joined
17:55 osa1 joined
17:56 whaletechno joined
17:57 <infinisil> Turns out I don't need it..
17:57 <APic> n
17:57 <infinisil> Hah
17:57 <APic> Sorry
17:57 FreeBirdLjj joined
17:58 mariatsji joined
17:59 trevorriles joined
17:59 <dmwit> Hand back your badge.
17:59 keepLearning512 joined
18:00 <infinisil> I already engraved it in my skin, too late!
18:01 ian_andrich joined
18:01 iAmerikan joined
18:03 dogweather joined
18:04 nitrix joined
18:04 fmixing joined
18:04 woodson joined
18:04 <glguy> You'll just have to scratch it out then, yikes!
18:06 raingloom joined
18:06 twanvl joined
18:07 zdenal joined
18:07 cybai joined
18:07 <* hackage> persistent-migration 0.0.1 - Manual migrations for the persistent library http://hackage.haskell.org/package/persistent-migration-0.0.1 (brandonchinn178)
18:08 FreeBirdLjj joined
18:08 karlguy joined
18:11 pparkkin joined
18:13 dsh joined
18:13 reygoch joined
18:16 connrs joined
18:16 <reygoch> Hi peeps
18:17 trevorriles joined
18:17 saurabhnanda joined
18:18 DarkUnicorn joined
18:19 <reygoch> I have the following code : https://lpaste.net/4968465867919589376
18:20 <dmwit> 2
18:20 <reygoch> problem is that it is becoming cumbersome to thread Semigroup constraints through all the functions that use it
18:20 <dmwit> (sorry)
18:20 errst joined
18:21 <reygoch> I'm wondering if there is a better way to write that because I'm getting functions with type signatures like this one:
18:21 <reygoch> doTheType :: (Monad m, Semigroup (m (Maybe (Maybe [String])))) => Validator A m B
18:22 <reygoch> can anyone give me some advice?
18:23 <dmwit> What do you want `x i <> y i` to do?
18:23 <reygoch> combine in what ever way
18:23 <dmwit> Perhaps `liftA2 (<>) (x i) (y i)` would suit your needs, and require fewer constraint annotations.
18:23 <glguy> \i -> x i <> y i is x <> y
18:24 <dmwit> Just `Applicative m` as opposed to `Semigroup (m (Maybe (Maybe [String])))`, e.g.
18:24 <dmwit> Uh. I don't believe you actually mean "just combine in whatever way". You surely have an actual desired behavior.
18:24 <dmwit> Or else I'm going to recommend `x <> y = x`.
18:24 <glguy> > (flip replicate 'a' <> flip replicate 'b') 4
18:24 <dmwit> Which has very few constraints indeed.
18:24 <lambdabot> "aaaabbbb"
18:25 <reygoch> well, I want it to be generic
18:25 <* glguy> leaves dmwit to figure out what the actually behavior was supposed to be
18:25 <dmwit> `x <> y = x` is very generic.
18:25 <reygoch> x i results in m ( Maybe e )
18:26 <reygoch> I don't know what e will be, I just know I want to combine it
18:26 <reygoch> if it is possible
18:26 <reygoch> I'll try with liftA2
18:26 <reygoch> and report back
18:26 <dmwit> hm
18:26 zachk joined
18:26 <dmwit> I am not a fan of this development strategy. But you do you, I guess.
18:26 justanotheruser joined
18:27 zachk joined
18:28 <infinisil> Reading the Lens docs..
18:28 Scip joined
18:28 <infinisil> "A strong lax semi-monoidal endofunctor"
18:28 <infinisil> Ah yes, I know exactly what that is
18:28 <maerwald> largely made-up terms I'd say xD
18:29 Welkin joined
18:29 <reygoch> ok, yes, this is much better
18:29 <reygoch> thanks a lot
18:30 dhil joined
18:30 <reygoch> dmwit: what do you mean by this development strategy?
18:30 cloudhead joined
18:31 <cocreature> infinisil: huh, where did you get that from? I can’t find it anywhere in lens’ source code
18:31 <infinisil> Ohhh it was just linked to from Lens
18:31 <infinisil> It's in semigroups: https://hackage.haskell.org/package/semigroupoids-5.2.2/docs/Data-Functor-Apply.html#t:Apply
18:31 <geekosaur> that's abstract math terminology.
18:31 <infinisil> Used by Fold1 in lens: https://hackage.haskell.org/package/lens-4.16.1/docs/Control-Lens-Type.html#t:Fold1
18:32 <infinisil> semigroupoids*
18:32 <cocreature> well it also has an explanation that’s fairly easy to understand so it’s not too bad
18:33 crobbins joined
18:33 <infinisil> Yeah, it could be worse
18:33 <infinisil> Speaking of worse, what the hell is this: `type Optical p q f s t a b = p a (f b) -> q s (f t)`
18:34 <cocreature> it’s a generalization of the various optics in lens
18:34 <cocreature> if you replace p and q by (->) you already get something pretty close to the definition of Lens
18:35 zdenal joined
18:35 <infinisil> Hmm yeah..
18:35 <infinisil> Never seen so many type arguments before
18:35 xtreak joined
18:37 <Psybur> % import Data.These
18:38 <yahb> Psybur: ; <no location info>: error:; Could not find module `Data.These'; Perhaps you meant; Data.Tree (from containers-0.5.10.2); Data.Text (from text-1.2.3.0); Data.Time (from time-1.8.0.2)
18:38 <* hackage> extensible-effects-concurrent 0.1.3.0 - Message passing concurrency as extensible-effect http://hackage.haskell.org/package/extensible-effects-concurrent-0.1.3.0 (SvenHeyll)
18:41 <geekosaur> ob i m a s t a b u
18:41 <* cocreature> runs away from geekosaur screaming
18:42 ccomb joined
18:42 <geekosaur> Mar 22 17:03:50 <edwardk> tgeeky: you get 'stab' 'pabst' and all sorts of fun combinations out of lens. i'm pretty sure i had it all but say 'i m a s t a b u' and i walked away
18:42 <geekosaur> sadly that was before I added year to the log format :/
18:43 <zachk> whats ob mean?
18:43 <geekosaur> 'obligatory (reference)'
18:43 <zachk> oic
18:43 <geekosaur> that wasa bit of a joke around the channel in 2016-2017
18:44 <Welkin> obgyn?
18:44 magthe joined
18:45 Luke joined
18:47 <dmwit> reygoch: "this development strategy" = "I don't want to think about what behavior I expect, let me just write some code that typechecks and cross my fingers that it turns out to behave well."
18:48 SpinTensor joined
18:49 <reygoch> dmwit: well, I'm collecting errors (which can be custom user errors) and if they are Semigroup I want them to combine in what ever way user envisioned
18:49 <reygoch> dmwit: that's what I meant
18:50 <dmwit> "defer to `e`'s Semigroup instance" is a fine answer, but there is also a question of what you want the `m` and `Maybe` bits to do.
18:50 <dmwit> I'm fairly confident that whatever you have right now... doesn't do what you want. Whatever that is.
18:51 <reygoch> dmwit: m is user provided monad and Maybe is error result :D
18:51 <reygoch> dmwit: and actually it is working so far, I'm writing a validation library
18:51 <dmwit> Okay. And what do you want `(<>)` to do with those monad actions and the `Maybe` result?
18:52 <dmwit> "Just combine them" *isn't an answer*.
18:52 <dmwit> There's a lot of possible behaviors.
18:52 <reygoch> well that is for user to decide
18:52 <dmwit> And writing a `Semigroup` instance amounts to choosing one of those behaviors.
18:52 Linter joined
18:52 <dmwit> No, it is for you to decide, because you are writing the Semigroup instance for `MyType`.
18:53 <reygoch> hm... not sure what you are referring to... if user doesn't provide `Semigroup e` than he can't use Semigroup instance of MyType
18:53 <reygoch> and that is just a wrapper
18:53 zar joined
18:54 <dmwit> User must decide how to combine `e`s: I'm on board. User must decide how to combine `Maybe e`s: I am not on board. Decide what you want to happen to `Nothing`s once and for all.
18:54 <dmwit> User must decide how to combine `m (Maybe e)`s: I will throw out the library and write my own.
18:54 camsbury joined
18:54 dogweather joined
18:55 <reygoch> oh.. that is decided by me already
18:55 <dmwit> User must decide how to combine `i -> m (Maybe e)`s: I will petition to have it removed from Hackage with blunt force. =P
18:55 <reygoch> only e is questionable
18:55 mkoenig_ joined
18:55 <reygoch> I think you misunderstood me
18:55 iAmerikan joined
18:56 <dmwit> I don't think I did. Because you were happy to move from `x i <> y i` to `liftA2 (<>) (x i) (y i)` without a second thought. But those two *behave very differently*.
18:56 <reygoch> btw, is it possible to write two instances for the same type but different constraints?
18:56 <dmwit> And there are other choices which also typecheck with yet other behaviors.
18:56 <reygoch> I tested it and it did what I intended
18:56 <reygoch> like, I tested an example
18:57 <reygoch> not just if it type checked
18:58 carlomagno joined
18:58 Welkin left
18:59 <reygoch> dmwit: I'd like to bother you just a wee bit more :D
18:59 <reygoch> dmwit: is it possible to do something like this : https://lpaste.net/955565051526250496
18:59 <dmwit> No.
19:00 <reygoch> I mean, obviously not with type classes but maybe some clever roudabout way?
19:00 <dmwit> You can make a newtype, or you can construct and pass dictionaries explicitly without using typeclasses at all.
19:01 wto joined
19:01 saurabhnanda joined
19:02 <reygoch> hm.. I think I'll check out dictionary approach. Thanks for advice!
19:02 Kacia joined
19:03 amirpro joined
19:03 <dmwit> I mean, for `Semigroup` in particular the dictionary is quite small. You are essentially just constructing and passing around an `X -> X -> X` function for some `X`.
19:05 grayhatter joined
19:05 grayhatter joined
19:07 ijks joined
19:07 nschoe joined
19:08 vukasink joined
19:09 JimmyRcom_ joined
19:09 wto joined
19:11 curious_corn joined
19:12 hugo joined
19:13 jfredett_ joined
19:14 Gurkenglas joined
19:14 fishythefish joined
19:14 ConTeXnician joined
19:16 cosmia joined
19:17 knupfer joined
19:17 Guest20417 joined
19:18 zero_byte joined
19:19 davr0s joined
19:20 dogweather joined
19:21 lortabac_ joined
19:22 DSM joined
19:26 woodson_ joined
19:27 blender joined
19:34 dhil joined
19:35 asdfjkljkl joined
19:35 iAmerikan joined
19:36 <* hackage> xml-html-conduit-lens 0.3.2.4 - Optics for xml-conduit and html-conduit http://hackage.haskell.org/package/xml-html-conduit-lens-0.3.2.4 (MatveyAksenov)
19:36 bendo joined
19:37 dogweather joined
19:41 blender joined
19:42 va3vna joined
19:43 albertus1 joined
19:44 TipsyMe joined
19:50 emtoomatrix[m] joined
19:51 <Psybur> @hoogle Maybe a -> Option a
19:51 <lambdabot> Data.Semigroup Option :: Maybe a -> Option a
19:51 <lambdabot> Intro Option :: Maybe a -> Option a
19:51 <lambdabot> Data.Semigroup getOption :: Option a -> Maybe a
19:57 DTZUZU joined
19:57 avocado joined
19:59 Gretchko joined
19:59 dogweather joined
20:01 DSM_ joined
20:04 paidnode joined
20:05 son0p joined
20:05 wennefer0 joined
20:08 rpme joined
20:09 woodson_ joined
20:11 dogweather joined
20:12 chaosmasttter joined
20:12 rblaze joined
20:14 Nd-69-m joined
20:15 dfeuer joined
20:17 amirpro joined
20:18 enterprisey joined
20:20 <rpme> Hi, I just tried to update cabal with cabal install cabal-install and it fails during building the hackage-security dependency. From what i can see it´s due to the new syntax used in the hacakge-security.cabal file
20:21 <rpme> any idea how to workaround this?
20:22 Dabo joined
20:22 <rpme> here is the log https://pastebin.com/bXDGykUb
20:23 jfredett joined
20:23 blankhart joined
20:24 <* hackage> libstackexchange 0.3.1 - StackExchange API interface http://hackage.haskell.org/package/libstackexchange-0.3.1 (MatveyAksenov)
20:24 <cocreature> rpme: no idea what your error means but you could try the bootstrap script for cabal-install to avoid relying on your existing installation
20:25 shutdown_-h_now joined
20:25 <cocreature> it doesn’t look like the error you’re seeing is related to the warning about build-tool-depends
20:26 <* hackage> siphon 0.8.1 - Encode and decode CSV files http://hackage.haskell.org/package/siphon-0.8.1 (andrewthad)
20:26 <rpme> cocreature: ok, will try this. thanks
20:27 <sclv> hmm: https://github.com/haskell/cabal/issues/5203
20:27 <sclv> its not new syntax i think
20:27 Zipheir joined
20:28 son0p joined
20:28 <cocreature> the build-tool-depends warning is due to new syntax, it’s just unrelated to the error
20:28 <Hjulle> I'm trying ghcid and it keeps tells me "All good" even after I change that I loaded to include obvious type errors or even syntax errors. I used "ghcid path/to/Module.hs --reload=path/to/Module.hs" and it tells me "Reloading" and then "All good" every time I change the file. What am I doing wrong/missing?
20:28 beauby joined
20:28 pfurla_ joined
20:29 <sclv> it looks like template-haskell got into a bad state somehow
20:29 canaria joined
20:30 alex`` joined
20:34 t7 joined
20:35 refold joined
20:35 zdenal joined
20:36 pfurla joined
20:39 xkapastel joined
20:41 fmixing joined
20:41 bo joined
20:41 <dmwit> Hjulle: Are you definitely writing to path/to/Module.hs?
20:42 m1dnight_ joined
20:42 nickolay_ joined
20:42 hexfive joined
20:48 Kundry_Wag joined
20:48 Putonlalla joined
20:54 Ariakenom joined
20:59 emilypi joined
20:59 wollw joined
20:59 canaria joined
20:59 oisdk joined
20:59 <Hjulle> dmwit: Yes. Otherwise it wouldn't have auto-reloaded.
21:01 danthemyth joined
21:01 pavonia joined
21:01 va3vna joined
21:04 Khisanth joined
21:05 cybai joined
21:07 sm joined
21:09 brocoli joined
21:12 _bo joined
21:14 <butterthebuddha> Is there a source of exercises or the like for getting familiar with the reader/writer/state monads?
21:18 youtmon joined
21:18 <maerwald> they all just hide function arguments in one way or another :)
21:23 Linter joined
21:25 meck joined
21:27 Tops2 joined
21:29 Tops21 joined
21:31 Tops22 joined
21:31 rschmukler joined
21:34 perspectival joined
21:35 imjacobclark joined
21:36 <imjacobclark> could anybody help me with converting a simpleHttp request body to a string?
21:36 <imjacobclark> https://pastebin.com/nXFYieX3
21:36 <imjacobclark> getting the following error and cant find much docs anywhere
21:36 <imjacobclark> Ambiguous type variable ‘m0’ arising from a use of ‘print’ prevents the constraint ‘(Show (m0 Data.ByteString.Lazy.Internal.ByteString))’ from being solved.
21:36 danso joined
21:37 <pavonia> You probably want "getHaskell >>= print"
21:37 <dmwit> imjacobclark: Without testing, I would guess you probably intended to write `getHaskell >>= print`.
21:37 <imjacobclark> indeed but i'd like to _return_ the string from the function
21:38 <imjacobclark> as id like the pass the string to another function
21:38 <dmwit> I don't understand why that's a problem.
21:38 <imjacobclark> it isn't i just don't know how to do it
21:38 <imjacobclark> wouldn't getHaskell >>= print just print to stdout
21:38 <dmwit> Sure. But `getHaskell >>= f` would pass it along to `f` instead of `print`.
21:39 <imjacobclark> oh i see
21:39 <imjacobclark> would it pass it as a String?
21:39 JimmyRcom_ joined
21:39 <dmwit> I don't think so. From the docs, `simpleHttp :: MonadIO m => String -> m ByteString`.
21:39 <dmwit> So it's a `ByteString`.
21:39 <imjacobclark> okay - that could work
21:40 Charn joined
21:40 Tops2 joined
21:40 <imjacobclark> That worked
21:41 <imjacobclark> Fantastic, thanks dmwit and pavonia
21:41 danthemyth joined
21:42 rasusto_ joined
21:45 jfredett joined
21:46 rcdilorenzo joined
21:50 canaria joined
21:52 <* hackage> sws 0.4.2.0 - A simple web server for serving directories. http://hackage.haskell.org/package/sws-0.4.2.0 (DerekElkins)
21:52 hiratara joined
21:52 <imjacobclark> another questino - how can i convert a bytestring to a string?
21:52 <imjacobclark> I tried `bytecodeToString string = T.unpack string` where T is `import qualified Data.Text as T`
21:53 aarvar joined
21:53 MP2E joined
21:54 oisdk joined
21:57 reactormonk joined
22:00 Dabo joined
22:00 babu` joined
22:02 <zachk> imjacobclark, Data.Text and Data.ByteString provide two different string types, they are different from each other, just import the proper Data.ByteString qualifed as BS or what have you and use BS.unpack instead of T.unpack
22:02 <imjacobclark> zachk: so i tried import qualified Data.ByteString.Lazy as L
22:02 <imjacobclark> doing bytestringToString string = findNewsroundLinks (L.unpack string)
22:03 <imjacobclark> i get the error Couldn't match type ‘GHC.Word.Word8’ with ‘Char’
22:03 dogweather joined
22:03 <zachk> I actually ran into this today
22:03 fmixing joined
22:03 <zachk> you want: import qualified Data.ByteString.Lazy.Char8 as BSL if you want lazy bytestrings
22:03 Tops21 joined
22:04 <imjacobclark> zachk: so this is the full code https://gist.github.com/imjacobclark/f45739924f4e3057eccd89cc3b185119
22:05 <zachk> just put that .Char8 after lazy and it should work
22:05 <* hackage> persistent-migration 0.0.2 - Manual migrations for the persistent library http://hackage.haskell.org/package/persistent-migration-0.0.2 (brandonchinn178)
22:05 <zachk> imjacobclark, have you thought of using tagsoup to scrape the html you download for tags? it's rather nice
22:05 <imjacobclark> zachk: ah cool im a step further now
22:06 beauby joined
22:06 <imjacobclark> i have but im new to haskell and im just trying to see if i can rewrite something i did in bash lol
22:06 revprez_ody joined
22:07 davr0s joined
22:08 cic joined
22:09 Tops2 joined
22:10 <jle`> ddellacosta: yes, you can witness it by writing functions `split :: NonEmpty a -> (a, [a])`, and `unsplit :: (a,[a]) -> NonEmpty a`, where `split . unsplit = id` and `unsplit . split = id`
22:10 enterprisey joined
22:10 <ddellacosta> jle`: awesome, thanks!
22:10 <ddellacosta> jle`: great piece (so far, not done yet) btw
22:10 <ddellacosta> really enjoying it
22:11 <jle`> thanks :) glad you're enjoying it
22:12 <jle`> thanks for bringing this up though, i just edited the post with a clarification
22:12 dysoco joined
22:12 Kundry_Wag joined
22:14 <dysoco> Hello I have a coding style question. Let's say in my code I use (x:xs) as parameter for lists. Should I use it even if I don't use the head and tail for the sake of simplicity or should I use simply 'l' for example?
22:14 <dysoco> s/simplicity/consistency
22:14 <jle`> if you don't use a binding, you should not give it a name
22:14 <jle`> using _ acts like a wildcard pattern
22:15 <dysoco> I mean like
22:15 <fishythefish> similarly, if you need to refer to the list but you don't need to deconstruct it, just bind it to a single variable
22:15 <dysoco> doSomething (x:xs) = doOtherThing (x:xs) vs doSomething l = doOtherThing l
22:16 <dysoco> oh ok
22:16 przembot joined
22:16 Tops21 joined
22:16 <dysoco> Also what's your position on 'where' clauses? do you use them heavily or only when things start to get messy?
22:17 <jle`> dysoco: those two are different things
22:17 vukonen joined
22:17 <jle`> your first version will fail if given []
22:17 <dysoco> oh interesting
22:17 <jle`> i'd probably write the first version was doSomething xs@(_:_) = doOtherTHing xs
22:18 <jle`> if i wanted to restrict it to only non-empty lists
22:18 <dysoco> I don't know what the @ means but we're not allowed to use anything not used in class so I'll stick with (x:xs) and l for this at least
22:18 <jle`> an "as-pattern" is a good way to restrict based on a pattern, but not care about the contents of the fields
22:18 <dysoco> I've seen it in a couple of places
22:18 <fishythefish> it's also common to write the empty list case first, so in that case, you can have `doSomething [] = doFirstThing; doSomething xs = doSecondThing xs`
22:19 <jle`> i also would probably not do that in general
22:19 <jle`> for lists it's fine, but it can cause problems in maintenance if you have a data type you cange
22:19 <jle`> *change
22:19 <fishythefish> for larger data types, this has maintainability concerns though
22:19 <fishythefish> gah, jle` beating me to the punch as usual
22:19 <jle`> ah, sorry :)
22:20 dogweather joined
22:20 <sm> use where (or let) if they seem to make the code clearer, and if the declarations aren't useful outside the current scope
22:21 Tops2 joined
22:22 <sm> though when developing, declarations at module level can be easier to troubleshoot
22:23 acertain joined
22:25 nitrix joined
22:25 <dukedave> If I have some higher order type `Loop a`, can I define `Eq Loop`-but-only-if `a` is `Eq` ?
22:25 <jle`> not in a sane way
22:25 epsilonhalbe joined
22:25 <acertain> is there any way to get ahold of the types in a GADT without a Proxy argument or a helper function? like given `data Foo a where Foo :: forall a. Num a => Foo a`, `f (Foo @a) = ... @a ...`?
22:26 <nitrix> I believe that'd require existential types?
22:26 <jle`> dukedave: there are some sort of weird ways that can easily cause incoherent or breaking code
22:26 <jle`> dukedave: (also note that neither `Loop a` or `Loop` are considered higher-order types)
22:27 <jle`> acertain: you can use ScopedTypeVariables
22:27 <nitrix> dukedave: data SpecialLoop = forall a . Eq a => SpecialLoop a
22:27 <dukedave> jle`: Oh? I thought higher order was just any type with a kind with arrows in it? :)
22:28 <jle`> first order are when you have a -> b
22:28 <jle`> higher order is (a -> b) -> c
22:28 <dukedave> jle`: ah, gotcha, thanks for clarifying!
22:28 <jle`> no problem :)
22:28 ft joined
22:28 <jle`> but yeah, there are some silly ways, but usually nothing i'd use seriously
22:29 <jle`> unless you know what sort of rabbit hole you are going down
22:29 <dukedave> nitrix: would that prevent me from writing `SpecialLoop TypeNotImplmentingEq`?
22:29 <jle`> in which case there are a lot of odd and quirky ways to abuse haskell's type system and/or ghc plugins to emulate what you want
22:29 <nitrix> dukedave: Notice the kind of SpecialLoop, it's not parametric.
22:29 <jle`> dukedave: do you have a use case for this type?
22:30 conal_ joined
22:31 <nitrix> dukedave: The constraint `Eq a` requires that the kind of `a` be `*`. The `SpecialLoop` I created has the kind `*`, your `Loop a` has kind `* -> *`.
22:31 hiratara joined
22:31 tzemanovic joined
22:31 Tops21 joined
22:31 <dukedave> jle`: I'm iterating on this https://wiki.haskell.org/Tying_the_Knot to create a data structure which represents a track in this game: https://boardgamegeek.com/boardgame/150/pitchcar
22:32 <jle`> actually hm
22:32 <jle`> i misread your original question
22:32 <jle`> it's actually extremely simple
22:32 <jle`> you just need to define `Eq a => Loop a`
22:32 <jle`> so `Loop a` will only have an Eq instance if a does :)
22:33 <jle`> it's similar to the Eq instance for (Maybe a)
22:33 <dukedave> Oh yeah, that's what I was hoping for. So, you can do that?!
22:33 <jle`> yeah :)
22:33 <jle`> actually usually that's the default derived instance
22:33 <jle`> instance Eq a => Maybe a where
22:33 <nitrix> data Loop a = .... deriving (Eq)
22:34 <jle`> sorry, totaly misread originally :) this is a very common thing
22:34 kmurphy4 joined
22:36 Kundry_Wag joined
22:37 dogweather joined
22:39 zdenal joined
22:40 <boj> give a library A, which has a sub-library B that does ../src in hs-source-dirs, and then a project C which imports sub-library B, i get a build error saying it can't find that relative ../src path (it works if i hardcode a static path). how do i get around this?
22:40 LiaoTao joined
22:41 <glguy> boj: Can you put the relevant cabal files on a pastebin?
22:41 <glguy> Why are these libraries depending on B's source files instead of its package?
22:43 <boj> A is a microservice, B is a servant-client which exports a sub-set of A to be consumed by unrelated project C without incurring unnecessary build dependencies from A
22:44 <glguy> so B should be a package that A and C depend on ?
22:44 <dukedave> nitrix: jle` : Thanks! I can't believe `deriving` is that smart, very cool
22:44 <boj> B is a package that C depends on
22:45 <boj> B itself depends on the src from A to re-export a few things, so it has hs-source-dirs: src ../src
22:46 <boj> when C goes to build, it sees that B is a dependent library and goes to build it. if the ../src is changed to a static path it works, the relative path is unfound otherwise
22:47 hugo joined
22:49 ft joined
22:49 louispan joined
22:49 tzemanovic joined
22:52 <nitrix> dukedave: Your use case is actually trivial. Sorry, I originally misunderstood you as well, throwing existential quantification at you :]
22:52 jfredett_ joined
22:52 <ZeuPiark> bye
22:53 <nitrix> I'm baffled that no-one corrected me on "your `Loop a` has kind `* -> *`". Should have been `*`.
22:54 kvda joined
22:54 <nitrix> Man, I miss Haskell :(
22:54 <dstolfa> nitrix: so use it again! :)
23:01 <dmwit> boj: I'm with glguy. You should put whatever B is using from ../src in B proper, and have A depend on B.
23:02 <boj> ok, i see. i'll give that a shot, thanks
23:03 xcmw joined
23:04 DSM joined
23:04 fmixing joined
23:05 <dmwit> (More to the point, I'm pretty sure cabal does not allow source directories to go farther up the directory tree than the cabal file is.)
23:05 Kundry_Wag joined
23:06 <boj> it works if you build within the project directory itself, but yeah, goes south if you build from an unrelated location
23:11 codesoup joined
23:11 insanitea joined
23:11 kvda joined
23:12 RegEchse joined
23:13 louispan joined
23:16 ru0mad joined
23:16 gestone joined
23:16 Linter joined
23:21 rprije joined
23:22 Tops2 joined
23:22 lortabac_ joined
23:27 newsham joined
23:28 Tops21 joined
23:29 zearen joined
23:29 rprije joined
23:29 XorSwap joined
23:30 dogweather joined
23:30 DTZUZO joined
23:33 zero_byte joined
23:33 kvda joined
23:34 kav joined
23:35 emilypi joined
23:36 kefin_ joined
23:37 granttrec joined
23:37 ru0mad joined
23:39 <nitrix> Does type inference always work from bottom-up? From the most generic type, `forall a. a`, then it gets constrainted as `forall a. C a => a`, where `C a` is a dictionary of types. With two constraints, `forall a. (C a, D a) => a`, they seem to act like an intersection of both set.
23:39 <nitrix> Does it always work that way are they other ways inference could work (possibly not by constraining and doing set intersections) ?
23:40 <nitrix> Sorry for the poorman terminology, I lack the theory and venturing in the unknown here (:
23:41 <nitrix> s/are they/or there/
23:41 zar joined
23:41 tomboy64 joined
23:42 kvda joined
23:43 <hpc> nitrix: i don't think i can answer your question perfectly for class constraints
23:43 seanparsons joined
23:43 <hpc> nitrix: but what you probably want to search for is "unification"
23:43 tomboy65 joined
23:44 <hpc> basically, types and values build up a system of equations that then gets solved
23:44 <hpc> a = (b, c)
23:44 rprije joined
23:44 <hpc> b = (c, Int)
23:44 <hpc> c = Bool
23:44 <hpc> a = you get the point ;)
23:45 <hpc> :t let {a = (b, c); b = (c, 5); c = True} in a
23:45 <lambdabot> Num b => ((Bool, b), Bool)
23:45 <nitrix> Right. I'm guessing the way that bubbles down and gets solved efficiently is where algorithms like Hindley-Milner kicks in.
23:46 plutoniix joined
23:46 <hpc> H-M isn't a specific algorithm
23:47 <hpc> saying "H-M algorithm" is a bit like saying "tree balancing algorithm"
23:47 <hpc> i don't know that there's a name for ghc's implementation of type inference
23:47 <nitrix> I have this makeshift visual programming language without type classes, but I am playing with the idea of introducing polymorphism, still without introducing type classes.
23:48 <hpc> (which, type inference is subtly different from unification)
23:48 <nitrix> So no parametric polymorphism, just some poor ad-hoc function overloading.
23:48 youtmon joined
23:48 jedws joined
23:48 <nitrix> And I was wondering if just some poor ad-hoc function overloading, I'm able to do type inference.
23:48 <hpc> (er actually ignore that)
23:49 seizo joined
23:49 <hpc> oh, yeah
23:49 jackdk joined
23:49 <hpc> sounds like you're making something like https://en.wikipedia.org/wiki/System_F#System_F%CF%89
23:49 <nitrix> You know, you gather all the different signatures possible for that function that's overloaded, then infer all the stuff in the callers using that function... everything gets its own little dictionary of possible types.
23:49 <hpc> type classes are where all the hard type system stuff is anyway
23:50 <hpc> nitrix: don't think in terms of sets, think in terms of equations
23:50 <nitrix> But then, choosing a type for an argument might have impacts on the options you have left for another argument so it gets really messy :(
23:50 <nitrix> hpc: Oh?
23:50 <hpc> so, maybe an example will help
23:51 <nitrix> hpc: Actually you're totally right.
23:51 <hpc> let's imagine that T(a) means "the type of a", just so i can keep unique symbols everywhere
23:51 <hpc> and use {a = (b, c); b = (c, 5); c = True} as the value level
23:51 <nitrix> hpc: You write down the equations and as you learn about the concrete types, some of the equations becomes solved and you have less unknowns.
23:51 <hpc> True :: Bool
23:51 <hpc> b = (c, 5) creates the equation T(b) = (T(c), Int)
23:51 <hpc> and so forth
23:52 <hpc> don't even think about simplifying the equations
23:52 djtyml_ joined
23:52 mizu_no_oto_work joined
23:52 Tops2 joined
23:52 <hpc> just get the whole set of type-level equations from looking at the value-level equations
23:53 <hpc> and then put it into the solver of your choice
23:53 <hpc> pure math :D
23:53 <nitrix> hpc: Since it's a visual programming language, it'd be kind of cool to show the remainder of the types possible for an argument, as you pin the type of other arguments, for a given function.
23:54 <nitrix> Doesn't that require simplifying and/or solving the equations at some point?
23:55 <hpc> so like, if you don't know T(c) but still want to have the IDE do what-ifs for T(b)?
23:55 fmixing joined
23:55 Tops21 joined
23:55 <hpc> maybe show the equations that still have unsolved variables (translated back to some in-language representation)
23:56 <hpc> have something next to it for "let T(c) = <type in here>"
23:56 <hpc> and run the type checker
23:56 weird_error joined
23:57 <nitrix> hpc: Essentially, I want people to experience the polymorphism, by seeing this very generic function drawn, then as they connect arguments, observe the set of their possible choices shrinking for the remainder of the arguments.
23:57 <hpc> now you've reduced the problem to "how do i autocomplete just T(c)"
23:57 <hpc> which you can do by showing what's currently in scope in some filtered way
23:57 <nitrix> Which is why I keep thinking in sets -.-
23:57 <nitrix> :o
23:57 <hpc> assuming you're going to have a big standard library or whatever
23:57 <nitrix> hpc: Yeah, you pick what you import.
23:57 perrier-jouet joined
23:58 <hpc> oh, you said no parametric polymorphism, yes ad-hoc
23:58 <hpc> all of my advice might be totally irrelevant lol
23:58 YongJoon joined
23:58 granttrec left
23:58 fishythefish joined
23:59 <hpc> i have a very user-level understanding of how type classes work
23:59 Tops2 joined