<    March 2017    >
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 20 21 22 23 _2_4 25  
26 27 28 29 30 31
00:00 JeanCarloMachado joined
00:00 bydo joined
00:00 atk joined
00:04 buglebudabey joined
00:05 markus1209 joined
00:05 jmcarthur joined
00:06 <athan> hmm, when quoting type constructors, do the types need to be defined in a different module?
00:06 <athan> (using TH)
00:06 markus1219 joined
00:06 <athan> I remember that if you intend to use the code generated, you need to import the TH-generated code from a different module
00:07 <athan> wait no, my fingers just fooled me x_x dang typos
00:09 dhil joined
00:09 Levex joined
00:11 variable joined
00:14 <fresheyeball> athan: wassap!
00:16 roconnor joined
00:17 SPKB24 joined
00:17 <SPKB24> hello
00:18 <SPKB24> anyone here?
00:18 <SPKB24> exit
00:18 <Axman6> a few
00:18 <SPKB24> quit
00:18 <SPKB24> oh hi
00:19 TxmszLou joined
00:19 <SPKB24> what are some of the best ways to learn haskell?
00:19 <Axman6> there's over a thousand people here at the moment, so aty least a few are probably awake
00:19 <* metalbot> queues religious war theme music
00:19 <snow_lemurian> Heyo!
00:20 <snow_lemurian> I really recommend Yet Another Haskell Tutorial
00:20 <snow_lemurian> Oops
00:20 <snow_lemurian> Too late
00:20 mofasa joined
00:23 theDon_ joined
00:24 aglorei joined
00:25 ices joined
00:25 plutoniix joined
00:25 deepfire joined
00:25 plutoniix joined
00:27 mbw joined
00:28 takle_ joined
00:30 JeanCarloMachado joined
00:30 defaultnick joined
00:32 Levex joined
00:34 wtetzner joined
00:34 andyhuzhill joined
00:34 <mbw> Hello everyone. I am currently working my way through Gabriel Gonzalez' lens tutorial: https://hackage.haskell.org/package/lens-tutorial-1.0.2/docs/Control-Lens-Tutorial.html. He claims that "[...]any Lens' is automatically also a valid Traversal' (since Functor is a superclass of Applicative)." Traversal' has an Applicative constraint, whereas Lens' has a Functor constraint. So this sentence does not make
00:34 <mbw> sense to me, shouldn't it be the other way round? After all, every Applicative Functor is a Functor, but not the other way round. Am I reading this wrong?
00:35 <Koterpillar> mbw: lens can take a functor
00:35 <Koterpillar> mbw: so if you give them an Applicative, because it's a functor, they'll still work
00:36 lambda-11235 joined
00:36 <mbw> Koterpillar: Ah, so the point is that the constraint applies to the function argument?
00:37 <Koterpillar> exactly
00:37 <mbw> I think that makes sense.
00:37 <Koterpillar> I think it's called "contravariant"
00:37 <mbw> This is some nifty stuff.
00:37 <monochrom> I don't understand "the constraint applies to the function argument".
00:38 <mbw> It's a type synonym for a unary function, the way I see it.
00:38 <mbw> type Traversal' a b = forall f . Applicative f => (b -> f b) -> (a -> f a)
00:38 nakal joined
00:39 <monochrom> That applies the contrait to the type variable f.
00:39 <* variable> waves to monochrom
00:39 <monochrom> Also f appears in the "return type" f a, which is not part of the function argument.
00:40 <monochrom> But what you need to think in terms of is Liskov substitutability.
00:40 andrei_chiffa_ joined
00:41 <mbw> I think that may be what confused me in the first place. I was regarding Traversal itself as a Functor.
00:41 <mbw> Well it is, since it's a function...
00:42 <mbw> What confused me was what I mistakenly read as "x is a Functor => it has to be Applicative as well", which is not true.
00:43 mofasa_ joined
00:43 <monochrom> "X is also a valid Y" happens when and only when "if I ask you for Y, you can give me X instead and it won't break my assumptions".
00:43 mwilly joined
00:44 <Koterpillar> where's that picture with producer/consumer covariance/contravariance explained with "If you want to (have|dispose of) some X, you give it to Y"?
00:44 <monochrom> Suppose I say, I need a sorting algorithm, I will only use it for lists of length 10, and elements are even numbers.
00:44 <monochrom> Are you right in supplying me with Prelude.sort, the most general sorting algorithm possible?
00:45 daddychevere joined
00:45 robertkennedy joined
00:46 <mbw> I sure hope so.
00:47 <monochrom> But note that "list of any length => list of length 10" is false. And "the element type is an Ord instance => the elements are even numbers" is also false.
00:47 buglebudabey joined
00:48 segmond joined
00:48 <monochrom> Let's modify my example to be less confusing and more relevant.
00:48 takle joined
00:49 frontendloader joined
00:49 <monochrom> I need a sorting algorithm. I will only use it on an element type that is an instance of both Ord and Num. (Ord a, Num a) => [a] -> [a].
00:50 <monochrom> Are you right to supply me with Prelude.sort :: (Ord a) => [a] -> [a]? Note that "Ord a implies (Num a, Ord a)" is false.
00:51 mendez joined
00:52 <mbw> Assuming the internally used predicate is (<=), I would think so. But Complex might be a special case...
00:52 <monochrom> Don't worry about Complex. Not an instance of Ord to begin with.
00:52 <mbw> exactly.
00:54 cyborg-one joined
00:54 <monochrom> OK? "Ord a implies (Num a, Ord a)" is false, so why can you give me sort of just the Ord constraint, where I "need" both Ord and Num?
00:54 arawack joined
00:54 <mbw> You didn't say you needed it. You only said that this is what applied to your type.
00:54 <monochrom> Yes.
00:55 <monochrom> A user of Travesal didn't say they needed Applicative. They only said they would use it with Applicative.
00:56 <monochrom> "Functor implies Applicative" is the wrong direction to care about. "Applicative implies Functor" is the correct direction.
00:56 kadoban joined
00:56 <mbw> mbw was inlightened
00:56 <mbw> This should be a koan
00:57 <monochrom> Just like you would look at "(Ord a, Num a) implies Ord a" in my example.
00:57 defaultnick joined
00:58 <mbw> How would you think of this in terms of covariant/contravariant? I only know these terms in the context of functors (and coordinate transformations, but that's another thing...). I know that these terms are used in OOP these days as well, but don't know how practically relevant it is.
00:58 <Tuplanolla> You can still think of it as implication if you word it "given `Functor`, I can produce `Applicative`", mbw.
00:59 <athan> Is there a GHC flag that shows call stacks when exceptions aren't caught?
00:59 Levex joined
00:59 <monochrom> contravariant on assumptions (such as type class constraints), covariant on return types.
00:59 <athan> I've been wrestling with `callStack` and `currentCallStack` to no avail;
01:00 <mbw> Could you elaborate on another (or the same) example, please?
01:00 defaultnick joined
01:01 nighty joined
01:02 <mbw> Regarding contra-/covariance.
01:02 <monochrom> I create a Java class "public abstract class M { public Object f(String x); }". You have written your class "public class W { public String f(Object x) ... }". Can you make W a subclass of M?
01:03 <lyxia> athan: the runtime option -xc https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/runtime_control.html#rts-flag--xc
01:03 <monochrom> This is the OOP kind of covariance and contravariance. Covariant in return type, contravariant in parameter type.
01:04 <mbw> Ok, I have never really programmed in Java. So just so that we're on the same page, all types are subtypes of Object in Java, right?
01:04 <monochrom> Yes.
01:04 <mbw> (C++ background)
01:04 <mbw> ok
01:05 i-amd3 joined
01:05 raycoll joined
01:06 <mbw> I would think, W can be instantiated as M. W::f() requires an Object, which a String is. It returns a String, which is an Object, which a caller of M::f() requires. Right?
01:06 <monochrom> Yes.
01:06 <mbw> I don't know what the "::" equivalent in Java is, though :)
01:07 <Koterpillar> dot
01:07 <Koterpillar> everything is dots
01:07 <mbw> Just like in Haskell.
01:07 <mbw> :/
01:08 <monochrom> Therefore you conclude that, as you go from a superclass method to a subclass method, return type can be subclassed (covariant), parameter type can be superclassed (contravariant).
01:08 JeanCarloMachado joined
01:08 <Koterpillar> https://i.stack.imgur.com/KjDLw.png
01:09 <mbw> Is that terminology rigorous, in the category theory sense? Or is it something like "Functor" used to describe function objects?
01:10 xaviergmail joined
01:10 <monochrom> rigorous.
01:11 <dmwit> I object. Terminology cannot be rigorous.
01:11 oisdk joined
01:12 <mbw> Well, rigorous is probably not the right term to use. There's no "dips" on words. But still, the concept of a Functor in Haskell is not quite the same as in OOP languages, for instance.
01:12 <mbw> So, maybe ambiguity is the issue, don't know.
01:12 <dmwit> I agree with everything you said there. But I still don't know what your question was. =P
01:12 <barrucadu> I don't think there's a general OOP usage of "functor", AFAIK the C++ usage is C++ specific
01:13 <barrucadu> Maybe C# also uses the term, I don't know
01:13 tommd joined
01:13 chao-tic joined
01:13 <mbw> Me only having done OOP in C++ should probably confirm your suspicion then.
01:14 <barrucadu> Unfortunately, "functor" means a different things in every language which uses it.
01:14 <monochrom> Fortunately there has only been 3.
01:14 <mbw> Oh, there are more uses of the word?
01:14 <monochrom> err, s/has/have/
01:15 <dmwit> I suspect monochrom's third is the way ML uses it.
01:15 <monochrom> Damn English. Why bother with singular vs plural, therefore countable vs uncountable
01:15 <monochrom> Yeah.
01:15 <monochrom> And why bother classifying hair as uncountable.
01:16 <mbw> If it's becoming less every day, it has to be countable.
01:16 <barrucadu> "hair" is a silly word which refers to two different, but very related, things
01:16 <barrucadu> Like many English words I suppose
01:17 doyougnu joined
01:17 <dmwit> Let's ditch it and use something sensible. Lojban, perhaps
01:17 <barrucadu> An individual hair, in which case it is a count noun; and a large collection of hairs, in which case is it not.
01:17 <barrucadu> Silly
01:18 <mbw> Am I going to become smarter if I keep staring at "Lojban"?
01:18 deepfire joined
01:18 <mbw> What is that?
01:18 <barrucadu> A constructed language which aims to be very logical
01:18 <monochrom> If you keep staring at something, you will die. (Tautologically.)
01:19 super6-1 joined
01:19 <dmwit> Are dieing and becoming smarter mutually exclusive?
01:20 <dmwit> dying
01:20 <mbw> You'll find out eventually.
01:20 <dmwit> I don't like English, too.
01:20 <monochrom> No, not mutually exclusive.
01:21 <monochrom> Just want to say something I am more sure of :)
01:24 <mbw> Man, Haskell really is a deep rabbit hole. I was looking at some HTTP library tutorials, in order to learn some basics. Then I noted that HTTP (the library) seems to work with [Char]. The nice tutorial of wreq lead me to learn lenses first. Which lead me to...
01:24 <mbw> I'm probably doing it wrong.
01:24 Levex joined
01:25 <dmwit> If you haven't typed `unsafe` into your compiler yet, you're probably not doing it wrong.
01:25 <dmwit> It's even possible that you're not doing it wrong even though you have typed `unsafe`.
01:25 krauq joined
01:26 <ertes> mbw: here is an experiment: try to read an interesting article on wikipedia without following a single link
01:26 JeanCarloMachado joined
01:26 <mbw> haha
01:26 <mbw> You got it. 5 new tabs/min.
01:26 krauq joined
01:26 <mbw> And I suspect firefox works with [Char] as well...
01:27 <ertes> haskell has the same effect
01:27 <athan> Y_Y I've used $(deriveJSON defaultOptions ...) with an extremely trivial data type, and it fails the `decode (encode x) == Just x` test. Wut do?
01:28 <dmwit> The solution depends on the problem.
01:28 <* dmwit> channels monochrom
01:28 <monochrom> I like the Y combinator.
01:29 michaelt joined
01:29 <dmwit> mbw: "nearly 25000 (!!) allocations are made for every keystroke in the Omnibox" https://groups.google.com/a/chromium.org/forum/#!msg/chromium-dev/EUqoIz2iFU4/kPZ5ZK0K3gEJ
01:29 <athan> shoot, can I not invoke $(..) splices in GHCi?
01:29 <monochrom> haha neat
01:30 defaultnick joined
01:31 <mbw> oh man
01:32 <mbw> The reasons they give seems to imply that some people have no idea what they're doing
01:32 <mbw> *seem
01:33 <athan> http://lpaste.net/353250 where did I go wrong? :U
01:33 <dmwit> mbw: I have a much more sympathetic interpretation: chromium is a big project, with a lot of people working on it, and none of them can hold the entire project in their head at once.
01:34 Rizy joined
01:34 JeanCarloMachado joined
01:34 <ertes> athan: probably nowhere… looks like deriveJSON doesn't handle singleton types properly… look at the JSON produced
01:35 <ertes> might be an empty object
01:36 <barrucadu> For types of the form `data Foo = Foo`, I have had the generic aeson stuff produce an empty array, rather than an object.
01:36 moet joined
01:36 <barrucadu> Which was a little surprising, as I expected an empty object
01:36 <mbw> That may be. On the other hand, there are rules of thumb when to use which data structure, when to preallocate memory etc. The problems they describe seem to stem in part from people being used to program in languages with reference semantics, not value semantics. But to be fair, C++ is a beast to tame.
01:38 <mbw> On the other hand I am personally frustrated with the memory footprint of popular software these days. I actually tried to use the Atom editor, only to have to hard reset my machine twice.
01:38 <mbw> But it looked so nice...
01:39 <mbw> Getting off-topic here I guess.
01:39 <MarcelineVQ> atom editor itself? or ghc-mod with atom editor?
01:39 conal joined
01:40 <mbw> It was probably in combination with haskell-specific plugins.
01:40 <MarcelineVQ> just curious because ghc-mod + stack = some amazing oom if you're not careful
01:41 <mbw> I did want to try for that reason. While my current vim setup works fine, it requires dicipline. Autocompletion with stack does not always work the way I want it to.
01:41 maybefbi joined
01:42 <mbw> With TemplateHaskell stuff, you can just forget about it (Yesod...).
01:42 <maybefbi> is there such a thing as easily modifiable tree in haskell? i want to do things like swap vertices
01:42 <dmwit> athan: The code generated here seems to be producing an object in ToJSON, but expecting an array in FromJSON.
01:42 <dmwit> athan: That's probably a bug.
01:43 <maybefbi> anyway to swap vertices in Data.Tree is also acceptable
01:43 chris_c joined
01:43 <athan> ertes: really?? that seems off - the {tag: Foo} object should be able to get turned into a `Foo` i reckon
01:44 <athan> dmwit: aie yie yie, thank you - I'll file a bug
01:44 <chris_c> Hi , i want to load turtle package into GHCI , my system is a brand new install of Debian 8.7.1 , i did the following: # apt-get update && apt-get install haskell-platform (this will install ghc 7.6.3 and cabal 1.20 ) $ cabal update $ cabal install turtle (cabal indicates that the install was successful, it should install turtle to global location.) $ ghci prelude > :l Turtle However, after step 5, ghci could not find turtle , my g
01:45 fDev2179 joined
01:45 <maybefbi> chris_c, do not use haskell-platform. use haskellstack
01:45 <maybefbi> haskell-platform on debian/ubuntu is always outdated beyond hope
01:45 <chris_c> hi maybefbi , thanks , let me try
01:46 <dmwit> athan: `deriveJSON defaultOptions { sumEncoding = TwoElemArray } ''Foo` works well here.
01:46 <dmwit> athan: Also, you may like `-ddump-splices` for further experimentation/debugging as you make `Foo` more exciting.
01:47 <chris_c> currently I use Nix to work with ghc and other library , they works fine , could I just use haskell Stack or Nix to upload to Hackage with Cabal?
01:47 pleax joined
01:47 FreeBirdLjj joined
01:48 <chris_c> I found that the hackage tutorial always jump too fast
01:48 juri_ joined
01:48 <dmwit> chris_c: What does `ghc-pkg list turtle` say?
01:49 <johnw> chris_c: does this help: cabal2nix --shell . > shell.nix && nix-shell --command 'cabal sdist' && nix-shell --command 'cabal upload dist/$FOO.tar.gz'
01:49 fresheyeball joined
01:49 <johnw> you'll need cabal2nix and cabal-install installed in your user environment
01:50 andrei_chiffa__ joined
01:52 <chris_c> > dmwit : /nix/store/8vdfwq62v8wd4i25yhw1sv7497g24b1r-ghc-8.0.2-with-packages/lib/ghc-8.0.2/package.conf.d turtle-1.3.1
01:52 gugah joined
01:52 <lambdabot> <hint>:1:9: error: parse error on input ‘/’
01:52 zeroed joined
01:53 <dmwit> chris_c: lol
01:53 <dmwit> chris_c: `:m + Turtle`, not `:l Turtle`
01:54 <dmwit> chris_c: `:l` is for loading from source. `:m` (or just normal old `import`) is for loading modules from installed packages.
01:54 <chris_c> dmwit : thanks , i miss it :)
01:54 pleax joined
01:55 <chris_c> > johnw : let me save your comment , i need to digest it and review it later
01:55 <lambdabot> <hint>:1:34: error: parse error on input ‘,’
01:55 <chris_c> you guys are helpful
01:55 <dmwit> I am *actually* cracking up over here.
01:56 chlong__ joined
01:56 <dmwit> We all overlooked this detail and jumped to very complicated alternatives. =P
01:56 <dmwit> (Including me! Checking on ghc-pkg was totally unnecessary.)
01:58 jsgrant- joined
01:59 mkoenig joined
02:00 defaultnick____ joined
02:00 paulsh94 joined
02:02 paulsh94 joined
02:03 agaric joined
02:04 mr_sm1th joined
02:06 i-amd3 joined
02:06 xaviergmail joined
02:08 <athan> sweet, I made a kinda cool websocket RPC dealio
02:08 <athan> it's pretty simple if anyone wants to see it
02:08 <athan> https://github.com/athanclark/websockets-rpc
02:09 michael3 joined
02:09 <athan> it lets you design a subscription / publication DSL pretty quickly, so you can invoke an RPC on a server, and stream messages back and forth before the routine is finished
02:10 <athan> (really useful for progress, tickers, log files, stuff like that)
02:12 roconnor joined
02:12 mekeor joined
02:13 mkoenig_ joined
02:14 takle joined
02:15 jmcarthur joined
02:15 nomotif joined
02:16 lak joined
02:21 defaultnick joined
02:22 xcmw joined
02:23 <jle`> hello all
02:23 <jle`> is there any way to invoke haddock and have it build other-modules/internal modules, as well?
02:23 <xcmw> What is the best way to convert a lazy byte string from Data.Binary to Text?
02:23 <dmwit> What encoding is it in?
02:24 mbw joined
02:24 <jle`> xcmw: check out the functions in this module http://hackage.haskell.org/package/text-
02:24 <jle`> one of them might be what you want
02:24 <xcmw> dmwit: I don't think it has an encoding
02:24 <dmwit> I don't think it's Text, then.
02:24 <jle`> is it just a bunch of bits?
02:25 <dmwit> Also I'm a bit confused about how Data.Binary is playing into things here.
02:25 <jle`> it's probably a bytestring that they're getting from functions in Data.Binary
02:25 <xcmw> jle`: Yes
02:25 <jle`> but yeah, Text is only meant to represent text. it's not really meant to represent random jumbles of bits
02:26 systemfault joined
02:26 <jle`> if the bytestring doesn't represent text, then you probably don't want Text
02:26 snow_lemurian joined
02:26 <jle`> maybe you want to display it in a nice way, like a base-64 encoding?
02:26 swampy joined
02:26 <jle`> or a hexadecimal represnetation?
02:26 <dmwit> Oh, like, this ByteString is the output of an encoding operation?
02:26 gugah joined
02:27 <xcmw> jle`: I don't need it to be readable I just need to convert between them
02:27 <geekosaur> xcmw, what are you intending to do with this data?
02:27 <dmwit> Why do you need to convert between them?
02:27 <jle`> that's like asking if you can convert "hello" to an Int
02:27 <jle`> text isn't meant to represent anything that isn't text
02:28 <xcmw> geekosaur: Store it in localStorage. Which means the data type must be an instance of toJSString and fromJSString
02:28 <swampy123> any lens maintainers around? wondering how to go about lifting the upper bound on containers?
02:28 <dmwit> swampy123: Perhaps #lens would serve you well.
02:28 <jle`> #haskell-lens
02:28 <dmwit> err
02:29 <swampy123> ah thanks! #lens doesn't exist
02:29 <dmwit> There's a lens-specific channel, anyway. Might be #haskell-lens.
02:29 <jle`> ##lens is a channel about optometry and optics
02:29 <Rotaerk> going there and asking questions about haskell lenses sounds fun
02:30 <dmwit> Whoof. I'm experiencing some mighty lag between my laptop and the computer I'm running irssi on. Apologies for slow/late replies.
02:30 <geekosaur> JSString is not a class, it is a newtype over String. You must encode your data somehow to something that can be represented as a String
02:30 <geekosaur> if it is binary data, consider something like hex or base64
02:31 takle joined
02:31 <geekosaur> if it is not textual, neither Text nor String is the right thing to use and you can expect your data to be corrupted if you try to force it
02:31 andrei_chiffa_ joined
02:31 <dmwit> JSString is not a class, but ToJSString/FromJSString are (in GHCJS).
02:31 cschneid_ joined
02:32 <geekosaur> ah. I asked hayoo but I don; think it handles ghcjs yet
02:32 <dmwit> I'll admit I'm kind of surprised by one of: GHCJS supports ByteString, or ToJSString/FromJSString does not supoprt ByteString.
02:32 <geekosaur> the same constraint will apply, though; you can't just slam it into a string, or you will get corruption or even rejected as invalid JSON
02:33 <geekosaur> you need to encode it into something that is String/Text-safe
02:33 defaultnick____ joined
02:33 <xcmw> geekosaur: decodeUtf8 and encodeUtf8 work from Data-Text-Lazy-Encoding
02:33 <dmwit> nooooo
02:33 <geekosaur> no, they won;t work for all inpiut data
02:33 <geekosaur> btu if you like occasionally losing completely, go ahead
02:33 <geekosaur> because you *will* get corruption at some point
02:34 <geekosaur> something will apply unicode normalization and *boom*
02:34 <dmwit> xcmw: For what it's worth, I find it odd that you are taking such a circuitous route. Why are you making a Binary instance, then trying to convert to Text, then converting to JSString? Why not just directly make instances of ToJSString and FromJSString for your types?
02:34 sword865 joined
02:35 <dmwit> geekosaur: Or even before that, he'll pass in some bytes that aren't valid UTF8.
02:35 <geekosaur> depends on exactly how they are abusing those functions
02:36 <geekosaur> you can feed binary data to something that encodes iso8859 to utf8
02:36 <geekosaur> you might even be able to extract it again if you are lucky
02:37 <xcmw> Should I use read and show instead?
02:37 takle joined
02:37 <geekosaur> hex or base64
02:37 <geekosaur> you seem insistent on trusting the untrustworthy
02:39 <xcmw> I will use base64 but is there a specific example of when encodeUtf8 and decodeUft8 fail?
02:39 connrs joined
02:41 <monochrom> There must be an xkcd for this.
02:41 robkennedy joined
02:42 robkennedy joined
02:45 Zialus joined
02:49 louispan joined
02:50 danvet joined
02:52 connrs joined
02:54 nemorichard joined
02:54 defaultnick____ joined
02:55 takle joined
02:56 dfeuer joined
03:00 hucksy_ joined
03:00 takle joined
03:04 doomlord joined
03:04 connrs joined
03:05 takle_ joined
03:05 texasmynsted joined
03:06 defaultnick____ joined
03:08 fabianhu joined
03:08 Fairy joined
03:09 shafox joined
03:11 <angerman> So I don't have an alternative instance for Either a b ... oh.
03:11 kanishka joined
03:12 spatial joined
03:12 <spatial> createarray :: IO ( IOArray Int Int) createarray = do { arr <- newArray (512,512) 0; return arr }
03:12 defaultnick joined
03:12 clinton joined
03:12 conal joined
03:12 <spatial> In imperative lang. I would store that array globally and read and write.
03:13 <spatial> I have multiple Haskell functions that have to read and write to that array. How is it done ?
03:13 <monochrom> Pass as parameter.
03:13 <spatial> Don't want to pass.
03:13 <c_wraith> close over it
03:14 roconnor joined
03:14 zcourts joined
03:14 <spatial> closure ? Treat me gently. I am learning.
03:15 <spatial> Struggled with State Monad for that. Didn't work.
03:15 <c_wraith> in general, "pass it as a parameter" is correct. Closing over it just means define all the functions that use it when the array is already in scope. It's awkward, but it's the only thing you can do other than pass it.
03:16 andyhuzhill joined
03:16 <c_wraith> State is just parameter-passing, by the way.
03:16 <ski> (a shorter way to define `createarray' is `createarray = newArray (512,512) 0')
03:17 danvet joined
03:17 gcross joined
03:18 defaultnick____ joined
03:18 <spatial> ski: Ok
03:19 takle joined
03:20 <ski> a process-extent mutable variable is seldom the right thing to do. more commonly one would like different threads, if executing same code, to access different versions ("threadsafe" and all that)
03:21 <c_wraith> A process-extent mutable variable is seldom the right thing to do *in any language*, by the way. It's just as bad of an idea in C as it is in Haskell. Haskell just makes it hard to do the wrong thing.
03:21 <ski> passing in an explicit parameters the things that a function needs to access is usually not that burdensome .. closing can also help
03:22 <ski> in case it becomes more burdensome (usually because you have many things you need to pass in), it can often help to bundle in a record, and optionally to hide the passing with `Reader' or `State'
03:22 drostie joined
03:22 connrs joined
03:23 <spatial> ski: Can you point me to an example of 'Reader' or 'State' ? for such arrays
03:25 Chef joined
03:26 <ski> in the case of references to mutable state, `Reader' (or probably `ReaderT', since you're presumably doing I/O here) would be enough
03:26 roboguy` joined
03:27 afarmer joined
03:27 <ski> the simplest would be to use `ReaderT (IOArray Int Int) IO', if you know that's the only mutable thing you need to access out of the implicit environment
03:27 cdg joined
03:27 <spatial> Let me try that
03:28 <ski> if you might want to add more things in the future (or now already), then probably instead `ReaderT MyMutableStuff IO', `MyMutableStuff' being a record type which has a field of type `IOArray Int Int', and possibly more fields as well
03:28 markasoftware joined
03:28 <ski> you can use `ioarr <- ask' in the former case to grab it
03:28 louispan joined
03:28 <ski> `ioarr <- asks getIOArr' in the latter case, if `getIOArr' is a selector function that extracts that field out of the record
03:29 <ski> you'll also need to use `runReaderT' in one (or perhaps a few) place(s), to pass in the initial `IOArray Int Int', after you've created it
03:30 aarvar joined
03:30 defaultnick joined
03:30 <ski> use `liftIO' to be able to call ordinary `IO' actions inside the `ReaderT (...) IO' context
03:31 mizu_no_oto joined
03:32 takle joined
03:33 xcmw joined
03:34 <spatial> Has someone created such an example ?
03:34 <c_wraith> ski just spelled out everything
03:35 <spatial> Let me search
03:38 xtreak joined
03:39 takle joined
03:40 conal joined
03:40 connrs joined
03:40 alx741 joined
03:44 halogenandtoast joined
03:46 numbers092024 joined
03:46 bungoman joined
03:47 Benzi-Junior left
03:51 connrs joined
03:52 zeroed joined
03:54 fDev2179 left
03:58 revprez joined
03:59 exferenceBot joined
04:01 tel joined
04:01 saurabhnanda joined
04:03 defaultnick_ joined
04:03 lspitzner joined
04:03 <zipper> Hey is there like isInfixOf that is case insensitive?
04:03 <zipper> A substring search
04:04 hexagoxel joined
04:05 <dmwit> map toLower x `isInfixOf` map toLower y -- ?
04:05 <kadoban> zipper: The usual pattern for that type of thing is: use toLower on both the needle and the haystack
04:05 <zipper> hmm
04:06 pavonia joined
04:06 ph88^ joined
04:06 defaultnick joined
04:06 steeze joined
04:07 <Koterpillar> weird unicode might mess with you here
04:07 <Axman6> there is a case insensitive string type used in some of the HTTP libs which might be useful
04:08 <Axman6> yeah you want to be sure this isn't for weird text, like in german the capital for 'ss' is a single character IIRC
04:08 <zipper> Koterpillar: Exactly my issue
04:08 wlemuel joined
04:09 <zipper> I want to check whether something is unicode from the content type
04:09 <zipper> Which is bytestring
04:09 <zipper> lol
04:09 <snow_lemurian> Why not use (<$> toLower) `on` isInfixOf ?
04:09 <zipper> There is char8.isInfixOf
04:09 <Koterpillar> content-type from an HTTP header?
04:09 <Koterpillar> HTTP headers are ASCII-only
04:09 <zipper> snow_lemurian: That assumes a string
04:09 <zipper> Koterpillar: Oh :)
04:10 <zipper> Koterpillar: That clears it all up
04:10 xaviergmail joined
04:11 <zipper> `decodeASCII` Deprecated: Use `decodeUtf8` instead
04:11 <ski> > isLower 'ß'
04:12 <lambdabot> True
04:12 <Koterpillar> ski: for completeness, that thingy is available in caps too
04:13 <dmwit> zipper: `decodeLatin1` is not deprecated
04:13 <dmwit> It covers all of ASCII and a bit more besides.
04:13 <dmwit> And unlike UTF8 won't ever fail.
04:14 <zipper> Why is charachter encoding so weird :(
04:14 <ski> Koterpillar : yeah, i was just looking for it :)
04:14 <ski> > isUpper 'ẞ'
04:14 <lambdabot> True
04:14 <ski> > toUpper 'ß' -- however, :/
04:14 <kadoban> Because characters are so weird ... because languages are so weird.
04:15 <lambdabot> '\223'
04:15 <dmwit> ...because humans are so weird.
04:15 <dmwit> It's weird turtles all the way down.
04:16 <Axman6> ski: yeah that's the one, thought that was the uppercase char but guess it's the other way
04:16 <ski> iirc, it's a ligature of `sz'
04:17 <Koterpillar> > toUpper 'ß' == 'ß'
04:17 <lambdabot> True
04:17 <ski> aye
04:17 wtetzner joined
04:18 <ski> one might have thought that `forall c. isLower c = True => isUpper (toUpper c) = True'
04:19 <Axman6> but one would be wrong!
04:19 otto_s joined
04:19 <Welkin> wolud two be wrong?
04:19 <Axman6> if n is wrong, n+1 is also wrong
04:19 <Axman6> one is the base case
04:19 <Welkin> what about n-1?
04:19 <Axman6> uh, n-1
04:20 <ski> depends ..
04:20 <Koterpillar> how do you get lambdabot to print unicode?
04:20 <ski> > text "ẞ"
04:20 <lambdabot>
04:20 <ski> > text "ß"
04:20 <lambdabot> ß
04:21 <Axman6> :t text
04:21 <Sornaensis> > text "°"
04:21 <lambdabot> String -> Doc
04:21 <lambdabot> °
04:21 <Koterpillar> > text $ filter (\c -> isUpper c && toUpper c /= c) $ [minBound..]
04:21 <lambdabot> DžLjNjDz
04:21 <Koterpillar> > text $ filter (\c -> isLower c && toLower c /= c) $ [minBound..]
04:22 <lambdabot> Terminated
04:22 supersixone joined
04:23 <ski> that's interesting. upper-lower ligatures
04:24 <Koterpillar> they are called title case
04:25 stoopkid joined
04:26 xcmw joined
04:26 <ski> ah, i see
04:26 <* ski> . o O ( <https://en.wikipedia.org/wiki/Small_caps> )
04:26 <Koterpillar> not even that
04:27 redmq joined
04:31 takle_ joined
04:32 louispan joined
04:35 <jle`> can i put latex math into haddock docs?
04:36 <jle`> i see this PR https://github.com/haskell/haddock/pull/465 that claims to let you do it, but, i'm not sure how to do actually do it
04:37 <jle`> what are the delimiters?
04:37 <jle`> it doesn't seem to be in the haddock docs
04:38 turnage joined
04:38 mbuf joined
04:39 YongJoon joined
04:39 <zipper> dmwit: I'm afraid that will break later when I try to decode utf8
04:39 <zipper> if something sneaky gets past
04:40 osa1 joined
04:40 osa1 joined
04:40 <MarcelineVQ> jle`: I've not used haddock but this part seems relevant https://github.com/haskell/haddock/pull/465/files#diff-3d298f660a24334a44b167637240db7d
04:41 xcmw joined
04:41 brynser_ joined
04:42 <jle`> hm it looks like docs were added here https://github.com/haskell/haddock/pull/525/files
04:42 <jle`> but the official docs as they are hosted online are outdated
04:42 <jle`> this PR was merged last june so like i wonder what happened
04:42 <jle`> MarcelineVQ: ah thanks!
04:43 Argue joined
04:43 xplat joined
04:45 P1RATEZ joined
04:45 P1RATEZ joined
04:48 <turnage> When a Reader monad is defined and the definition calls "ask", how does ask access the Reader's context?
04:50 <Axman6> that depends on the particular instance, but for the trivial Reader (r -> a), ask r = r (where ask has type r -> r)
04:50 <Koterpillar> turnage: the bind implementation for this monad passes the context to each action, and ask simply returns that passed parameter
04:51 patbecich joined
04:51 <Axman6> for ReaderT, which is essentially r -> m a, it's just ask = ReaderT (\r -> return r)
04:51 thecrooked joined
04:52 robotroll joined
04:52 <turnage> so ask, inside the definition of a reader, has access to the reader's context field?
04:54 Polarina joined
04:55 xplat joined
04:55 vwker joined
04:55 Arthimus joined
04:55 <turnage> Oh, ask is defined for the Reader class as an action that yields the context? And ask implicitly received the reader as a parameter because it is called inside the Reader definition?
04:56 <Welkin> there is `ask` and `asks`
04:57 <turnage> I mean ask as in this sample: http://adit.io/posts/2013-06-10-three-useful-monads.html#the-reader-monad
04:57 xcmw joined
04:58 takle joined
04:58 <ski> Koterpillar : well, it's not the same, but it reminded me of that
05:01 Textmode joined
05:02 vwker` joined
05:02 <turnage> I think my question is basically, how is it that ask can yield different values when it doesn't appear to take any parameters?
05:03 Rainb joined
05:03 <turnage> oh
05:03 <turnage> nvm I see
05:03 roconnor joined
05:03 <Koterpillar> You'll see it if you expand the definitions of it and bind
05:04 takle joined
05:04 <turnage> thanks for the help Koterpillar; just pulled up the source
05:04 connrs joined
05:04 FreeBirdLjj joined
05:05 vtomole joined
05:05 Wizek joined
05:05 thunderrd_ joined
05:05 buttons840 joined
05:06 <buttons840> can someone help me figure out this type error http://lpaste.net/353255
05:07 <buttons840> i thought the two versions of the code (with and without do notation) were equivalent?
05:07 isenmann joined
05:07 <geekosaur> buttons840, suggest you take the do-based one and ask ghci its type
05:08 <geekosaur> just for starters
05:08 <Koterpillar> buttons840: $ ate your bind
05:08 <buttons840> actually, i messed up the error message, let me fix it
05:08 <geekosaur> however, the real problem is likely to be what Koterpillar said: ($) is not magical, it scopes as far as it can and this *includes* the (>>=) ... which changes the whole type
05:09 <geekosaur> wheras do notation stops it at the ends of the line (modulo indentation for continuation)
05:10 <monochrom> @quote monochrom point.free
05:10 <lambdabot> monochrom says: "point free" can be decomposed to: "point" refers to ".", "free" refers to using no "$". :)
05:16 path[l] joined
05:16 <lpaste_> Buttons840 pasted “Same error without $ ” at http://lpaste.net/353257
05:16 <buttons840> geekosaur: I removed the $ and just used parens and have the same issue: http://lpaste.net/353257
05:16 <geekosaur> your parens are wrong
05:17 <geekosaur> the =<< goes *outside* the pure
05:17 <Koterpillar> you replaced pure . Card with pure applied to Card...
05:17 cschneid_ joined
05:17 <geekosaur> the paramerter to pure, that is
05:20 <buttons840> i had `f = (code here, no type holes)` and got an error saying GHC found [Side] but expected IO Card (Card is a [Side] newtype) -- so I thought adding `pure . Card (same code as before)` here would turn it into the required type?
05:21 <Koterpillar> please go through the types of each expression again
05:22 <roboguy`> buttons840: note that that is parenthesized `pure . (Card (same code as before))`
05:23 LeCamarade joined
05:23 eklavya joined
05:24 jsgrant- joined
05:24 Rainb joined
05:25 xall joined
05:25 hololeap joined
05:27 <hololeap> is `sequence [Just 1, Just 2, Nothing]` essentially the same thing as to `Just 1 >>= (\_ -> Just 2) >>= (\_ -> Nothing)` ?
05:28 <pacak> > sequence [Just 1, Just 2, Nothing]
05:28 <lambdabot> Nothing
05:28 <pacak> > sequence [Just 1, Just 2]
05:28 <lambdabot> Just [1,2]
05:28 roboguy` joined
05:28 <pacak> hololeap: Not quite. It tries to collect results.
05:29 Polarina joined
05:29 <hololeap> what is a method that essentially chains together monads like (Thing 1 >>= Thing >>= Thing >>= Thing) etc where you can specify the number in the chain or have it run infinitely
05:30 comingsoon joined
05:30 <ski> hololeap : use `sequence_' instead, and it's essentially the same
05:30 <pacak> :t forever
05:30 <lambdabot> Applicative f => f a -> f b
05:30 <pacak> :t sequence_
05:30 <lambdabot> (Foldable t, Monad m) => t (m a) -> m ()
05:30 <ski> @type replicateM_
05:30 <pacak> :t replicateM_
05:30 <lambdabot> Applicative m => Int -> m a -> m ()
05:30 <lambdabot> Applicative m => Int -> m a -> m ()
05:31 <hololeap> what if you want to keep the result at the end like a chain of state monads
05:31 afarmer joined
05:31 <ski> "like a chain of state monads" ?
05:31 <ski> collect results in a list or what ?
05:31 <ski> or pass one intermediate result from one to the next ?
05:31 <ski> @type foldM
05:31 <lambdabot> (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
05:32 <dmwit> :t foldr (>=>) return
05:32 <lambdabot> (Foldable t, Monad m) => t (c -> m c) -> c -> m c
05:32 <dmwit> :t replicateM
05:32 <lambdabot> Applicative m => Int -> m a -> m [a]
05:32 <dmwit> Really hard to tell what's wanted, to be honest.
05:33 <pacak> hololeap: Can you explain your task in a bit more details? An example maybe?
05:33 <hololeap> it's not a task
05:33 <pacak> Whatever you are trying to achieve
05:33 Fairy joined
05:33 <hololeap> i'm just trying to get a better grasp of some details. should i start at the beginning?
05:33 <pacak> Go ahead
05:33 <dmwit> hololeap: http://stackoverflow.com/q/40983249/791604 possibly
05:38 pleax joined
05:40 connrs joined
05:41 saurabhnanda joined
05:41 ner0x652 joined
05:43 <buttons840> do { a <- b; c $ d a } is that the same as (c $ d) =<< b ?
05:43 <Koterpillar> no
05:43 insitu joined
05:44 <Koterpillar> it's the same as (c . d) =<< b
05:44 <hololeap> essentially, i've been trying to learn how to code a simple interactive interface with state, thus the state monat transformer with IO. i found that you could essentially write an infinite loop with `execStateT (sequence $ repeat (StateT addLine)) 0`
05:44 <hololeap> where addLine is a function: Int -> IO (Int, Int)
05:45 osa1 joined
05:45 osa1 joined
05:46 <dmwit> Alternately: it is the same as `(\a -> c $ d a) =<< b`.
05:46 <buttons840> Koterpillar: ok, now I see what you were saying about $ eating my bind
05:46 takle joined
05:47 vtomole joined
05:47 <hololeap> so it's passing the first value through many actions, but what if i want the end value passed to something else? and how could i drop out of the chain while still carrying that value?
05:48 <jle`> hello all
05:48 <hololeap> for instance somebody typing "exit" would drop out of the chain, but the state would then be written to a file
05:48 <jle`> how do i provide documentation for record accessors made from pattern synonyms?
05:48 <dmwit> hololeap: Don't use `repeat`.
05:48 TxmszLou joined
05:49 <buttons840> style question: I have the one liner I wanted (I like to avoid do notation until i know how to write the code without it): `pure . Card . sortOn (\(Side n _) -> n) =<< shuffleM a` -- is this horrible? should I use do notation instead?
05:49 <jle`> `pure . f =<< x` is just fmap f x
05:49 <jle`> or f <$> x
05:50 <jle`> so `Card . sortOn f <$> shuffleM a`
05:51 <buttons840> jle`: i see, ty
05:51 <jle`> the ugly part is the lambda with pattern matching
05:51 <jle`> but if Side is a record, you can use the record accessor
05:52 patbecich joined
05:52 <buttons840> it is not a record
05:52 <buttons840> i know lens would be nice here, but I don't really know it and these small anoyances haven't pushed me to learn it yet
05:53 zeroed joined
05:53 <jle`> well
05:53 <jle`> lens itself doesn't really directly help
05:54 <jle`> in this case the lens library would give you TH to automatically generate accessors
05:54 connrs joined
05:54 <jle`> the actual concept of lenses isn't too useful here
05:54 <buttons840> lens would let me avoid writting out the lambda through, right?
05:54 <buttons840> (not that a small lambda is a huge burden)
05:55 <jle`> you can avoid writing out the lambda by writing a helper function
05:55 <jle`> getThing (Side n) = n
05:55 <dmwit> Am I the only one that things `\(Side n _) -> n` is perfectly readable?
05:55 Xanather joined
05:55 <jle`> the lens *library* offers template haskell that lets you generate the accessor atuomatically
05:55 <jle`> but lenses themselves are orthogonal to the issue
05:55 <buttons840> true, if I write this lambda multiple times I will break it out into a named function
05:55 pantsman_ joined
05:55 <dmwit> This does not need fifteen minutes of engineering.
05:56 <jle`> dmwit: it's not too bad, but i don't like that the eye jumps in different directions when reading it
05:56 <jle`> buttons840: so, lens itself doesn't really offer anything too useful here, and the lens library offers some TH that is very very marginally useful
05:56 <jle`> don't worry about it :)
05:57 ner0x652 joined
05:57 <buttons840> ok, thanks for pointing out that i could use fmap -- that was a useful simplification
05:58 takle joined
05:59 <jle`> buttons840: btw, if the type that Side is has the auto-derived Ord instance, sortOn (\(Side n _) -> n) should be somewhat-similar to just 'sort'
05:59 <buttons840> hmm, i was reaching for both Applicative and Monad methods, when I could have just used Functor, interesting
05:59 <ski> dmwit : not the only one
06:00 defaultnick_ joined
06:00 monochrom joined
06:01 nemorichard joined
06:02 <ski> hololeap : you could make an `exit' "drop out of the chain", by using exceptions (by which i mean something like `Either'), or continuations (`Cont')
06:02 <hololeap> ski: i'm looking at ExceptT right now
06:02 safe joined
06:03 <ski> @unmtl StateT s (ErrorT e m) a
06:03 <lambdabot> s -> m (Either e (a, s))
06:04 <ski> would allow you to stop with a value of type `e', which would be the only result surviving, so if you want to save your state `s' (or part of it), better make it part of `e'
06:04 <ski> @unmtl ErrorT e (StateT s m) a
06:04 <lambdabot> s -> m (Either e a, s)
06:04 <ski> would otoh make the state `s' survive the exception, which might perhaps be handier ..
06:04 <hololeap> it's telling me that it's deprecated and to use ExceptT instead :)
06:04 <ski> also, don't use `ErrorT', use `ExceptT' :)
06:05 tommd joined
06:05 <ski> yeah, but `untml' hasn't been updated to recognize `ExceptT', which was why i was using `ErrorT' in the query to it
06:06 <ski> hololeap : anyway, this would presumably be a relatively local use of `ExceptT', only used to achieve this effect .. which is fine, imho
06:06 <hololeap> ski: what do you mean?
06:07 <hololeap> what is untml?
06:07 <threshold> How is the return type signature for sieveUO :: Int -> UArray Int Bool ? I see a "do" and a "return" http://rosettacode.org/wiki/Sieve_of_Eratosthenes#Haskell
06:07 <ski> hololeap : anyway, since you were using `execStateT' rather than `evalStateT' or `runStateT', you could use `sequence_' instead of `sequence' since you don't care about the individual results of the actions in the list .. and then you could abbreviate that by `forever'
06:08 <ski> @help unmtl
06:08 <lambdabot> unroll mtl monads
06:08 dec0n joined
06:08 <hololeap> the help isn't helping me much :p
06:09 [scrooge] joined
06:09 <hololeap> no idea what that means
06:10 dogweather joined
06:10 <snow_lemurian> Anyone uses Liquid Haskell here?
06:10 <ski> @hoogle runSTUArray
06:10 <dogweather> i'd like to start ... looking some very concrete examples
06:10 <lambdabot> Data.Array.ST runSTUArray :: (forall s . ST s (STUArray s i e)) -> UArray i e
06:10 <lambdabot> Data.Array.ST.Safe runSTUArray :: (forall s . ST s (STUArray s i e)) -> UArray i e
06:10 <ski> threshold : the `do' is for `ST s'
06:11 <dogweather> Liquid Haskell is for specifying a little more about a functions' parameters?
06:11 <c_wraith> and return type.
06:11 <ski> hololeap : `unmtl' is a lambdabot command for unwrapping a few monad transformers, to remind oneself of issues like whether the state survives an exception or not, with one or the other ordering as above
06:12 connrs joined
06:12 <snow_lemurian> dogweather: Kind of, it is to have proofs about the type you are using
06:12 <ski> (in the case it does not survive, that means that the state is rolled back to what it was when the exception catching construct was entered)
06:12 <hololeap> i would have to see it in action
06:12 <dogweather> L.H. didn't install directly via `stack install`, so I'm going to come back to it when i have a chance
06:13 super6-1 joined
06:13 <ski> hololeap : you've already seen it, scroll up a little bit
06:14 <hololeap> my search is only showing 2 instances of "unmtl" in the history
06:14 <hololeap> it might be broken :(
06:14 <dogweather> Would L.H. help with a "Year" type, which is an Integer constrained to (say) 1800 > y > 2025?
06:14 xcmw joined
06:14 <ski> hololeap : about eleven minutes ago
06:15 defaultnick_ joined
06:15 <dogweather> I'm currently implementing a Year with newtype and a toYear function https://github.com/dogweather/nv-statutes-haskell/blob/master/src/Year.hs
06:15 mvr_ joined
06:16 <c_wraith> dogweather: yes, liquidhaskell is good for that.
06:16 jsgrant-_ joined
06:17 <c_wraith> dogweather: liquidhaskell adds a type of subtyping called refinement types - you can add predicates about the values the type can take.
06:17 jhrcek joined
06:17 <c_wraith> dogweather: it uses an SMT solver to check the refinements, which means it can handle arithmetic predicates nearly automatically
06:19 andyhuzhill joined
06:20 <dogweather> thanks c_wraith. I'm having trouble finding concrete examples of simple cases like Year. Know any?
06:20 supersixone joined
06:20 supersixone joined
06:21 <dogweather> I'm reading the official introduction, but it spends a lot of time on the implementation details and not much on a finished piece of code
06:21 <c_wraith> dogweather: probably because they assume that it's trivial in comparison to the examples they do provide - if you understand the examples presented, you can handle simpler things.
06:22 <c_wraith> Hmm. There is other documentation
06:22 unK_ joined
06:22 raycoll joined
06:23 <c_wraith> dogweather: have you checked out http://ucsd-progsys.github.io/lh-workshop/ ?
06:23 jsgrant-_ joined
06:23 <dogweather> No! I hadn't seen that one - thanks
06:24 Jicoss joined
06:24 <hololeap> holy crap that hurts my brain
06:24 path[l] joined
06:24 Argue_ joined
06:25 tsmish joined
06:25 <hololeap> ski: would you kindly explain to me why s would survive in your second example?
06:26 <hololeap> @unmtl ErrorT e (StateT s m) a
06:26 <lambdabot> s -> m (Either e a, s)
06:26 begriffs joined
06:26 sibi joined
06:27 defaultnick_ joined
06:29 andyhuzhill joined
06:30 xcmw joined
06:31 takle joined
06:32 kazagistar joined
06:32 FreeBirdLjj joined
06:35 <spatial> Read and write to array. Is http://pastebin.com/78skkV3u the way to start ?
06:36 andyhuzhill joined
06:36 <qmm> https://stackoverflow.com/questions/4713906/purely-functional-equivalent-of-weakhashmap
06:38 <dogweather> c_wraith: it seem like Template Haskell may have some overlap with L.H.?
06:38 <c_wraith> dogweather: the only connection I see offhand is that they both run at compile time.
06:39 <dogweather> ok, true. i guess i can imagine them being used to solve similar problems
06:39 laz joined
06:39 pleax joined
06:39 <c_wraith> Possibly. I haven't considered it.
06:40 <dogweather> i guess actually, a mini-liquid-haskell could be written in template haskell
06:40 <c_wraith> it certainly could be
06:41 NextHendrix joined
06:41 <c_wraith> The main advantage of liquid haskell's current implementation is that it's optional. Everything is valid Haskell if you compile it without liquid haskell
06:42 ramzifu joined
06:42 defaultnick_ joined
06:42 Micamo joined
06:44 <Rotaerk> huh, LH looks cool
06:44 <c_wraith> though I'd like to see a haskell-like language built from scratch around liquid types. I hear F* was built around refinement types, but that's more F#-like, and I don't know if it has a solver built in.
06:44 Edith_ joined
06:45 owiecc joined
06:46 <hololeap> the thing i don't understand is, wouldn't a Left value drop out, and in this case, wouldn't that correspond to `e'?
06:46 xcmw joined
06:47 <ski> hololeap : well, in `s -> m (Either e a, s)', regardless of whether we get `Left e', with `e :: e', or `Right a', with `a :: a', we still also get an `s' back
06:48 connrs joined
06:49 <ski> hololeap : otoh, in `s -> m (Either e (a, s))', either we get one `a' and one `s', or we get only an `e'. in the latter case, the only reasonable thing an exception-catching construct could do is to use the only `s' it knows, the one which was in effect before attempting the "guarded" action, to use as the state to continue with
06:49 <hololeap> that leads me to something else i don't understand: in order for us to use Either to "drop out", wouldn't it have to be the outermost monad?
06:49 <ski> nah
06:50 <hololeap> cuz laziness? :)
06:50 michaelt joined
06:50 <hololeap> that's usually the answer for things i don't understand
06:50 <c_wraith> Laziness has nothing to do with it
06:50 <ski> no
06:50 insitu joined
06:50 aglorei joined
06:50 <ski> consider
06:50 <ski> (>>=) :: StateT s (ExceptT e m) a -> (a -> StateT s (ExceptT e m) b) -> StateT s (ExceptT e m) b
06:50 <ski> which desugars to
06:51 thc202 joined
06:51 <ski> (>>=) :: (s -> m (Either e (a, s))) -> (a -> s -> m (Either e (b, s))) -> s -> m (Either e (b, s))
06:51 <ski> the third argument is the initial `s', we pass it to the first argument, get back `m (Either e (a, s))'
06:52 xtreak_ joined
06:52 <ski> we execute that `m'-action (using `(>>=)' for `m', let's ignore this detail here), result is `Either e (a, s)
06:52 <ski> '
06:52 <ski> we can only continue with `a -> s -> m (Either e (b, s))' if we have an `a' (and an `s')
06:53 <ski> in the `Right' case, we have those, so we get `m (Either e (b, s))' which matches the return type
06:54 <ski> in the left case we have only an `e' (call it `e' as well, so that `e :: e'), so we use `return (Left e)', to match the return type, using `return' on `m' here
06:54 <hololeap> is that a facet of the monad transformer?
06:54 <hololeap> returning if the types don't match up?
06:54 <zipper> Brian hurts when I try to transform monads :(
06:54 ThomasLocke joined
06:54 <hololeap> poor brian
06:55 <ski> so, in the `Left' case, we skip performing the right argument of `(>>=)', aborting the action sequence, "floating" the exception upwards for e.g. further surrounding `(>>=)' calls (or exception-catching calls) to take care of
06:55 greatBigDot joined
06:56 <ski> hololeap : with a plain `Either e', the same thing would happen, re short-circuiting
06:56 <ski> the only difference with `StateT s (ExceptT e m)' here is (a) we're also passing around a state `s'; (b) we're performing actions in some "underlying" `m' monad
06:57 takle joined
06:57 <hololeap> i feel like we're going too far down the rabbit hole of tracing haskell's exceution path. isn't that what functional programming is supposed to get away from? is there a more general pattern that i am missing
06:58 revtintin joined
06:58 <hololeap> or was it me who started going down this rabbit hole to begin with? :)
06:59 <ski> (well, execution is not the same as evaluation. what i was describing here was how execution of `StateT s (ExceptT e m)' was defined in terms of ordinary evaluation (involving passing around `s' and short-circuiting alternative `e' results), and execution of `m')
06:59 <ski> perhaps a bit :)
06:59 <ski> @type catchError
06:59 <lambdabot> MonadError e m => m a -> (e -> m a) -> m a
07:00 defaultnick_ joined
07:00 <ski> catchError :: StateT s (ExceptT e m) a -> (e -> StateT s (ExceptT e m) a) -> StateT s (ExceptT e m) a
07:00 <ski> becomes
07:00 <ski> catchError :: (s -> m (Either e (a, s))) -> (e -> s -> m (Either e (a, s))) -> s -> m (Either e (a, s))
07:01 <ski> as with `(>>=)', we start by passing the initial state (third argument) to the first argument, getting `m (Either e (a, s))', executing it as an `m'-action (using `(>>=)' for `m') to get `Either e (a, s)'
07:01 connrs joined
07:01 danvet joined
07:02 monochrom joined
07:02 <ski> if we have `Right' here, we just use `return' to forward this as a result of executing the action made by calling `catchError'
07:02 <ski> but if we have `Left', we need now to call `e -> s -> m (Either e (a, s))' with this `e', and an `s'
07:03 <ski> but *which* `s' ?
07:03 hdeshev joined
07:03 <ski> the first argument, `StateT s (ExceptT e m)', aka `s -> m (Either e (a, s))' has quite possibly computed intermediate states of type `s' internally ..
07:03 <ski> .. but there's no way to get at those from this vantage point
07:03 <ski> all we have as result is an `e'
07:03 tripped joined
07:04 jud joined
07:04 jud joined
07:04 <ski> the only `s' we could continue the exception handler `e -> StateT s (ExceptT e m) a', iow `e -> s -> m (Either e (a, s))' with is the initial `s' `catchError', which was fed to the first argument
07:05 <ski> i.e. we *roll-back* the state to what it was when entering the exception-catching construct !
07:05 <ski> hololeap : makes any sense ?
07:06 <hololeap> @unmtl ErrorT (IO ()) (StateT [a] IO) b
07:06 <lambdabot> [a] -> IO (Either (IO ()) b, [a])
07:07 <hololeap> @unmtl ErrorT () (StateT [a] IO) b
07:07 <lambdabot> [a] -> IO (Either () b, [a])
07:08 freusque joined
07:08 <ski> hololeap : now, if you do the same kind of desugaring with `ExceptT e (StateT s m)', you'll see that in that case `catchError' will get the state when throwing the exception (which might perhaps be violating some invariants perhaps, inbetween safe points when modifying individual parts of the state)
07:09 <ski> .. which means that it can continue with that state, instead of reverting
07:09 <zipper> Is there a haskell style guide somewhere? One that people follow?
07:10 <ski> .. now, this argument is a bit hand-wavy, right. it only suggests that it should be possible to get these two behaviours, by stacking the monad transformers in these two different ways
07:10 tsmish joined
07:10 raichoo joined
07:10 <ski> .. but it so happens that these are the two behaviours the individual implementations of operations will yield, when combined by stacking in one or the other way
07:11 <ski> zipper : someone mentioned <https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md>, and it looked at least half-decent, on a quick look
07:11 takuan joined
07:11 ramzifu joined
07:11 <ski> (though i indent by two spaces)
07:12 <hololeap> @unmtl StateT () (ExceptT [a] IO) b
07:12 <lambdabot> () -> ExceptT [a] IO (b, ())
07:12 <ski> `unmtl' doesn't understand `ExceptT', leaves it intact (and everything "inside" it)
07:13 <hololeap> @unmtl StateT () (ErrorT [a] IO) b
07:13 <lambdabot> () -> IO (Either [a] (b, ()))
07:14 <hololeap> so it just swaps if Either is inside the tuple, or if the tuple is part of Right ...
07:14 <hololeap> sorry, my processing time is slow :)
07:14 <ski> yes, that's correct
07:15 sujeet joined
07:15 <hololeap> i'm re-reading what you wrote and processing...
07:15 <ski> so either the state is always returned, or it's only returned on a right/proper/dexter return (as opposed to left/sinister return, resulting from throwing an exception)
07:16 <* ski> . o O ( `data Vel s d = Sinister s | Dexter d' )
07:17 <ski> (.. of course, sometimes "exception" is what you "normally" expect as a result of some processing)
07:17 whiteline joined
07:18 defaultnick_ joined
07:18 <hololeap> ski is from the u.k.? :) i have never heard of dexter/sinister before, but it apparently has to do with a coat of arms
07:18 <ski> "sinister" and "dexter" is latin for "left" and "right"
07:18 mwsb joined
07:18 <hololeap> is this commonly used in C.S.?
07:19 <ski> not that i know :)
07:19 <hololeap> lol, ok then.
07:19 cschneid_ joined
07:19 connrs joined
07:19 <ski> just trying to make use of preexisting association between "left" and "bad", respectively "right" and "good"
07:20 <hololeap> ok, i understand
07:20 FreeBirdLjj joined
07:20 <hololeap> in other words, abstracting from left/right which don't mean much in this context
07:21 <ski> (that in turn presumably comes from when humans started farming, and had to make handed tools, and (simplifying the explanation) so to not have to make both left and right handed tools, only make ones of one kind, which happened to be ones which are most comfortable to use with right hand. as a result, right-handed people survived better)
07:22 takle joined
07:23 quchen joined
07:23 louispan joined
07:24 <zipper> ski: Thankee
07:24 _sg joined
07:25 <ski> zipper : fwiw, i also use form feeds .. and indent the body of a module :)
07:25 connrs joined
07:25 <maybefbi> on one hand we have recursion schemers, insisting that recurring part of the type be parametrized so that Fix can hide in there. but on the other hand, libraries like Data.Tree or any recursive type not parametrizing the recursive part of the tree. why is it this way?
07:25 kosorith joined
07:26 <ski> `Fix' is unfortunately a bit awkward to use ..
07:26 <maybefbi> hmm yeah
07:27 Ch3ck joined
07:27 <maybefbi> i guess then recusive schemes will remain an oddity
07:27 <ski> (also, `Fix F' doesn't determine `F', meaning that there can be many different ways of, given a type `T', specifying a type `F' such that `T' is iso to `Fix F')
07:27 <zipper> ski: You indent the body of a module? Like all your code is indented?
07:28 solrize joined
07:28 <ski> e.g., given `T' a binary tree, you could choose to have `F' only abstract over right sub-trees
07:28 <zipper> You can't be serious.
07:28 <zipper> Show me an example ski
07:28 <ski> or have `F' correspond to two layers of a tree, not one
07:28 Huang joined
07:28 Fairy joined
07:28 <hololeap> ski: i wonder if the fact that the heart is on the left has anything to do with that
07:29 <hololeap> or vice-versa
07:29 <hololeap> *the fact that the heart is on the left *in most people*
07:31 <maybefbi> ski, ok
07:33 path[l] joined
07:33 Khisanth joined
07:34 <piyush-kurur> question regarding ffi calls in haskell: is it possible to call system calls directly or does one need to wrap it in a C stub function and call the stub function instead
07:34 <ski> zipper : <http://lpaste.net/10060>
07:35 <ski> hololeap : i dunno. iirc it is possible to have the upper organs reversed without the lower organs, and vice versa
07:36 defaultnick_ joined
07:37 freusque joined
07:37 zeroed joined
07:37 zeroed joined
07:38 pleax joined
07:38 byte512 joined
07:38 osa1 joined
07:38 osa1 joined
07:39 coius joined
07:41 jutaro joined
07:41 eklavya joined
07:41 <mniip> piyush-kurur, ffi calls cdecl-declared functions
07:41 <mniip> or well, maybe some other calling convention
07:42 <mniip> depending on your OS, system calls might or might not be that
07:42 xall joined
07:42 <piyush-kurur> mniip: thanks.
07:42 <mniip> depending on platform details, even, (think vdso/vsyscall)
07:43 srbaker_ joined
07:43 supersixone joined
07:43 takle joined
07:44 connrs joined
07:45 <piyush-kurur> I think then it is safer to just wrap it in c.
07:45 <piyush-kurur> Wait, in my case I can assume it is linux so may be I can get away with it
07:47 <hololeap> @unmtl StateT [a] (ErrorT () IO) b
07:47 <lambdabot> [a] -> IO (Either () (b, [a]))
07:48 Micamo joined
07:48 pleax joined
07:48 haldean joined
07:48 paolino joined
07:48 hazmat__ joined
07:49 haldean left
07:50 raichoo joined
07:53 takle joined
07:53 patbecich joined
07:54 SpinTensor joined
07:55 <mniip> piyush-kurur, does the syscall you want to call have a libc wrapper?
07:55 <mniip> I'd use that
07:56 <piyush-kurur> mniip: it is getrandom and o god what a mess it is
07:56 <piyush-kurur> I did not realise it is such a mine field out there
07:57 thecrooked joined
07:57 <piyush-kurur> thanks to Ford_Prefect for showing me what a disaster the getrandom on Linux is
07:59 Argue joined
08:01 xcmw joined
08:04 jutaro joined
08:06 r3dc0d3r joined
08:06 defaultnick_ joined
08:06 edsko joined
08:06 cods joined
08:07 <dminuoso> piyush-kurur: Can you fill me in on this?
08:07 <dminuoso> Im curious.
08:09 <piyush-kurur> dminuoso: Ford_Prefect is the right person, I guess he is around
08:09 <piyush-kurur> I will point you to some links that he sent me
08:10 <dminuoso> Fair enough. Was hoping you had those links ready for me. :)
08:10 <piyush-kurur> for example this is how system d uses "getrandom" https://github.com/systemd/systemd/blob/master/src/basic/missing_syscall.h#L72
08:10 <piyush-kurur> dminuoso: warning make sure you do not have a heart condition before looking at it
08:11 <dminuoso> piyush-kurur: And please elaborate which part of this is "confusing" or "bad" ?
08:11 mdarse joined
08:11 <piyush-kurur> some staring at openssl code base would have given you the necessary imunity (if you are not dead yet that is)
08:11 <dminuoso> Honestly, I'm not seeing anything obvious wrong with this code. Please fill me in.
08:12 <piyush-kurur> dminuoso: the manpage on linux innocently says the existance of a getrandom fucntion except that it is not there
08:12 <dminuoso> piyush-kurur: What do you mean?
08:12 <piyush-kurur> https://bugzilla.kernel.org/show_bug.cgi?id=194797
08:13 steeze joined
08:14 Beetny joined
08:15 BartAdv joined
08:16 guiben joined
08:17 minn joined
08:17 takle joined
08:18 <piyush-kurur> dminuoso: and here is another https://lwn.net/Articles/711013/ saying getrandom has finally arrived in glibc although I do not know why it is a glibc thing when the particular syscall is a linux specific thing
08:18 r3dc0d3r left
08:18 sirmob joined
08:18 defaultnick_ joined
08:20 dickbarends joined
08:20 rossberg joined
08:21 kian joined
08:21 kian joined
08:22 mkoenig joined
08:23 <Ford_Prefect> piyush-kurur: glibc is what provides the headers and (potentially) function stubs that call syscall()
08:24 yezariaely joined
08:24 defaultnick_ joined
08:24 takle joined
08:27 <zipper> ski: Isn't indenting like that too much work?
08:27 schjetne joined
08:28 bjz joined
08:28 <Ford_Prefect> piyush-kurur: you'll notice there's also a proposal (not actually being implemented) to have a linux-specific-syscall library
08:29 albertid joined
08:30 ploop joined
08:31 defaultnick_ joined
08:32 fizruk joined
08:34 <dickbarends> \leave
08:34 dickbarends left
08:34 michaelt joined
08:36 defaultnick_ joined
08:36 mkoenig joined
08:37 thecrooked joined
08:37 aib joined
08:40 takle joined
08:41 mmn80 joined
08:41 Jicoss joined
08:42 connrs joined
08:43 hexagoxel joined
08:43 pleax joined
08:44 path[l] joined
08:44 ragepandemic joined
08:45 fuzzy_id joined
08:45 FreeBirdLjj joined
08:47 gregman_ joined
08:48 defaultnick_ joined
08:50 quchen joined
08:50 comingsoon joined
08:51 xfix joined
08:51 takle joined
08:52 sablib joined
08:55 refold joined
08:57 ramzifu joined
08:58 saurabhnanda joined
09:02 xcmw joined
09:02 grayjoc joined
09:03 Detrumi joined
09:04 mendez joined
09:05 Iskarlar joined
09:08 janos_ joined
09:08 Gurkenglas_ joined
09:09 louispan joined
09:10 insitu joined
09:12 oberstein joined
09:12 frontendloader joined
09:12 louispan joined
09:15 <piyush-kurur> Ford_Prefect: I do not understand why glibc is designed in such a way. I thought glibc is meant to be a portable library
09:16 aib joined
09:16 <piyush-kurur> the link on lwn that you forwared shows the confusion that results in adding a system specific call to a generic library
09:16 <dminuoso> The glibc is not meant to be portable at all.
09:17 <dminuoso> The glibc is an ugly collection of non-portable hacks for legacy reasons.
09:17 raichoo joined
09:17 <dminuoso> With so many Drepper codes that were written because he felt educating others on how to write code was a good thing to do.
09:18 <piyush-kurur> dminuoso: Much like how OpenSSL was written to learn writing multi-precision integer arithmetic I guess
09:18 nick_h joined
09:18 mekeor joined
09:19 <dyreshark> on the bright side, it has a strfry function
09:19 <dyreshark> so at least it can sautee strings pretty well
09:20 paulsh94 joined
09:20 xtreak joined
09:20 <piyush-kurur> dyreshark: Wow glibc is starting to look like openssl
09:22 <dyreshark> ...in that it's written in c?
09:22 <* dyreshark> has never actually read any openssl source
09:22 <piyush-kurur> dyreshark: good that you did not try
09:22 <barrucadu> dyreshark: `man strfry` pointed me to `man memfrob`, which made me sad :(
09:22 louispan joined
09:23 <piyush-kurur> If programming was literature than openssl would be Vogon poetry
09:24 <dyreshark> yeah, i'm not actually sure why memfrob exists, except as a joke
09:24 zero_byte joined
09:24 <dyreshark> but i'm sure some application somewhere depends on it in order to function
09:25 FjordPrefect joined
09:26 FjordPrefect joined
09:27 CurryWurst joined
09:27 <barrucadu> Something somewhere will break if the xor constant is changed from 42
09:27 Flonk joined
09:27 <M-Magnap> I sure hope not! It'd be like https://xkcd.com/1172/ except in real life
09:28 oisdk joined
09:29 whald joined
09:29 systadmin joined
09:30 oisdk joined
09:30 pleax joined
09:30 dec0n joined
09:31 fizruk joined
09:31 kosorith joined
09:32 defaultnick____ joined
09:33 halogenandtoast joined
09:33 saurabhnanda joined
09:34 Trenif joined
09:34 louispan joined
09:35 tomphp joined
09:35 Jicoss joined
09:38 nick_h joined
09:38 revtintin joined
09:39 raichoo joined
09:39 merijn joined
09:41 hexagoxel joined
09:42 Chobbes joined
09:43 chirpsalot joined
09:43 bec joined
09:45 <raylocal> Hi, am I doing something wrong here : i get 6 as the random everytime for - randomR (1,6) (mkStdGen 3) , randomR (1,6) (mkStdGen 5) and randomR (1,6) (mkStdGen 50)
09:46 raylocal joined
09:46 <raylocal> Hi, am I doing something wrong here : i get 6 as the random everytime for - randomR (1,6) (mkStdGen 3) , randomR (1,6) (mkStdGen 5) and randomR (1,6) (mkStdGen 50)
09:48 <merijn> raylocal: THe default random generator is...not ideal :)
09:48 janos_ joined
09:48 <merijn> There was a thread about this a while back, but I forget the link
09:49 sirmob joined
09:50 <cocreature> if you bug carter often enough, he will release the new version of random with a better rng :)
09:50 <merijn> raylocal: Basically, seeds that are similar tend to result in similar random numbers
09:50 <merijn> raylocal: 3 and 50 being "similar" in the scheme of 0 through maxBound
09:51 <raylocal> oh o kay
09:51 <merijn> There are several other decent random generators on hackage
09:52 <raylocal> thanks you are right. I managed to get a different one with mkStdGen 6747264
09:52 minn joined
09:52 <Xnuk> > map (fst . randomR (1,6) . mkStdGen) [0..]
09:52 <lambdabot> [6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6...
09:52 fenris joined
09:53 <liste> > map (fst . randomR (1,6) . mkStdGen) [0,1000..]
09:53 <lambdabot> [6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6...
09:53 <liste> > map (fst . randomR (1,6) . mkStdGen) [0,10000000..]
09:53 <lambdabot> [6,6,6,6,5,5,5,4,4,4,3,3,3,2,2,2,1,1,1,6,6,6,5,5,5,4,4,4,3,3,3,2,2,2,1,1,1,6...
09:53 <Xnuk> > length . takeWhile (==6) $ map (fst . randomR (1,6) . mkStdGen) [0..]
09:53 <lambdabot> 53668
09:54 <merijn> tf-random and mwc-random provide better (but not cryptographic) randomness
09:55 <merijn> mwc-random is also superfast, iirc
09:55 <Xnuk> > map (fst . randomR (1,6) . mkStdGen) [0,53667..]
09:55 <lambdabot> [6,6,5,4,3,2,1,6,5,4,3,2,1,6,5,4,3,2,1,6,5,4,3,2,1,6,5,4,3,2,1,6,5,4,3,2,1,6...
09:56 <merijn> But if you don't care too much, simply using System.Random is fine
09:56 patbecich joined
09:56 <raylocal> I am not looking for the strength . just trying out the state monad chapter of the wikibook. Was just curious why it was giving me 6 all the time
09:56 <merijn> There's also newStdGen which does better initialisation
09:56 ejay joined
09:56 lukaramu joined
09:56 <raylocal> for real random we have hardware random number generators we can use ;)
09:56 <piyush-kurur> shameless self promotion. In case you want cryptographically secure randomness have a look at raaz. We have an interface that I hope is simple enough (do not use it in multiple threads though)
09:57 kosorith joined
09:57 <piyush-kurur> I am sure cryptonite might also have some prg in it
09:57 mohsen_ joined
09:58 <piyush-kurur> raylocal: even with cryptographic prg be careful when you want to generate random numbers in a particular range
09:58 <piyush-kurur> do not just take modulo
09:59 takle joined
10:00 defaultnick____ joined
10:00 janos_ joined
10:01 <raylocal> I do not really need to generate a industrial strength random thankfully but we do run statistical tests on clients RNG (TRNG /PRNGs) but that is just me clicking a button to run the script.
10:02 saurabhnanda joined
10:03 xcmw joined
10:04 <Athas> I just use this one: http://stackoverflow.com/a/12996028
10:04 <Athas> They say it's cool to run your own crypto, after all.
10:06 <merijn> I just stole MurmurHash3 when I needed a fast hash
10:06 Argue joined
10:06 <Athas> Does it have a very small state? (That was my main need, as I needed hundreds of thousands of threads, each with their own RNG state.)
10:06 spatial joined
10:06 <spatial> type ArrayAccess = ReaderT (IOArray Int Int) IO Int readvalue :: ArrayAccess -> Int readvalue arr = do a <- ask b <- readArray a 1; return b
10:07 <merijn> I think so? lemme check
10:07 <spatial> Does this allow array read ?
10:07 <Athas> spatial: it allows array writing, too.
10:08 FreeBirdLjj joined
10:08 <merijn> Athas: It boils down to this: https://github.com/merijn/GPU-benchmarks/blob/master/evolve.cpp#L67-L109 But this is a rather stripped down and specialised version of the open source one by Google
10:09 <Athas> merijn: a uint64_t as the seed/state? That's fine.
10:09 <Athas> Maybe I'll switch to that one if I actually need *good* random numbers.
10:09 lavalike_ joined
10:09 <spatial> ä <- ask doesn't work.
10:10 <merijn> Athas: Well, it was written by google specifically to be very fast, so minimal amount of state is obviously required for that :)
10:11 <spatial> Couldn't match kind `*' with `* -> *'
10:11 Argue_ joined
10:11 <Athas> spatial: type ArrayAccess = ReaderT (IOArray Int Int) IO
10:11 certainty joined
10:12 <Athas> readvalue :: ArrayAccess Int
10:12 <Athas> The array is stored in the monadic context of the ArrayAccess monad, so there's no argument to the readValue function.
10:13 schjetne joined
10:13 louispan joined
10:13 systadmi1 joined
10:14 xall joined
10:15 lavalike joined
10:15 <spatial> type ArrayAccess = ReaderT (IOArray Int Int) IO readvalue :: ArrayAccess Int readvalue = do a <- ask b <- readArray a 1; return b
10:15 bdeferme joined
10:15 <Athas> spatial: yes, that should work (if you insert appropriate line breaks).
10:16 Argue__ joined
10:16 <spatial> No instance for (MArray IOArray Int (ReaderT (IOArray Int Int) IO)) arising from a use of `readArray'
10:16 edvorg joined
10:17 ThreeFx joined
10:17 <Athas> Ah, right. You have to use 'liftIO (readArray a 1)'.
10:18 <Athas> Since readArray runs in the IO monad, but you are in a ReaderT on top of IO. liftIO allows you to lift an IO action into the ArrayAccess monad.
10:18 <spatial> You mean monad transformet stack.
10:19 <spatial> one inside the other
10:21 <spatial> createarray :: IO ( IOArray Int Int) createarray = do { arr <- newArray (512,512) 0; return arr } I create the array like this.
10:21 danthemyth joined
10:21 baetheus joined
10:21 <spatial> liftIO works. How is createarray used with readvalue ?
10:22 orbifx joined
10:23 systadmin joined
10:25 xtreak joined
10:25 Gk-1wm-su joined
10:25 oish joined
10:25 <Athas> spatial: well, createArray runs in IO, and readValue runs in ArrayAccess.
10:26 <Athas> You'd run createArray in the IO monad, and then you'd use runReaderT to run readValue in the IO monad.
10:26 <Athas> Something like: do { a <- createArray; liftIO (runReaderT readValue a) }
10:26 <Athas>
10:27 deepfire joined
10:27 <spatial> Athas: Really appreciate it.
10:28 Levex joined
10:28 <Athas> spatial: but be careful, because your ReadArray monad doesn't really provide just read-only access to the IOArray.
10:29 rgr joined
10:29 <spatial> I will write also.
10:29 tomboy64 joined
10:30 marr joined
10:30 <Athas> Alright, that's good, then.
10:30 louispan joined
10:31 Jicoss joined
10:31 Wizek_ joined
10:32 <M-Magnap2> A monad transformer stack will still be a monad
10:33 defaultnick_ joined
10:34 Chobbes joined
10:34 chirpsalot joined
10:34 silver joined
10:36 roundhouse joined
10:37 nemorichard joined
10:37 magthe joined
10:37 deepfire joined
10:37 bennofs1 joined
10:38 owiecc joined
10:39 owiecc_ joined
10:40 <jophish> hi jchia_, sorry I was away this weekend, did you find a solution to your problem with vector-sized?>
10:40 defaultnick_ joined
10:41 <jophish> the easiest way at the moment would probably be to use withVectorUnsafe
10:42 <jophish> this allows you to change the underlying vector as long as you promise to not change the size.
10:42 defaultnick____ joined
10:43 xall_ joined
10:44 mthek joined
10:46 <merijn> bleh, I wish there was a library that was the best of both worlds of Groundhog and Persistent >.>
10:46 yogsototh joined
10:48 rgr joined
10:50 ozgura joined
10:51 janos_ joined
10:52 tremon joined
10:52 dijkb_ joined
10:52 <spatial> type ArrayAccess = ReaderT (IOArray Int Int) IO readvalue :: ArrayAccess Int How can I pass additional Int argument to readvalue ?
10:53 <spatial> Should ArrayAccess change too ?
10:54 jaspervdj joined
10:54 <liste> spatial: readvalue :: Int -> ArrayAccess Int ?
10:55 Oejet joined
10:55 Levex joined
10:56 mmn80 joined
10:56 ozgura joined
10:57 defaultnick____ joined
10:57 freechips joined
10:58 systadmin joined
10:59 <spatial> readfromarray = do { a <- createarray; liftIO (runReaderT readvalue 1 a) } That throws error is I pass '1'
10:59 hazmat__ joined
11:00 <Athas> spatial: (runReaderT (readvalue 1) a)
11:00 defaultnick____ joined
11:00 sablib joined
11:00 <spatial> :-) An imperative programmer struggling with Haskell.
11:00 xtreak joined
11:01 pickle_ joined
11:01 <dminuoso> spatial: The weird thing is, I just started with Haskell after having dived into React + Redux hardcore. Suddenly the whole concept of functional programming seemed quite intuitive right from the get-go.
11:01 <dminuoso> Though grokking redux reducers was a bit of a PITA.
11:01 <dminuoso> :-)
11:01 <spatial> OCaml was like that for me. Not Haskell
11:02 <spatial> I wasn't prepared for Monad.
11:03 Guest22296 joined
11:03 ozgura joined
11:04 xcmw joined
11:05 <spatial> You mean Redux is written in Haskell ?
11:06 <spatial> That was JS
11:06 <dminuoso> spatial: No, but it uses a purely functional approach to describe how state is derived from actions.
11:06 <dminuoso> Rogjt/
11:06 <dminuoso> Right.
11:08 jophish joined
11:10 marfoldi joined
11:11 Trenif joined
11:11 eklavya_ joined
11:11 janos_ joined
11:12 Rainb joined
11:12 MindlessDrone joined
11:13 V3 joined
11:14 cads joined
11:15 deepfire joined
11:16 kuribas joined
11:17 jespada joined
11:18 mr_sm1th joined
11:19 <V3> Hi everyone.
11:19 <V3> Over the past few months, I have written Blast, a distributed computing library, inspired by Apache Spark.
11:19 <V3> It is now open source and can be found on github: https://github.com/jcmincke/Blast
11:20 pickle_ left
11:20 xcmw joined
11:20 <kuribas> cool.
11:21 Chobbes joined
11:21 cschneid_ joined
11:22 <Unhammer> V3, you should share on https://gitter.im/dataHaskell/Lobby :)
11:23 <Unhammer> (or I can if you don't want to make yet another account)
11:23 chirpsalot joined
11:23 augur joined
11:24 defaultnick____ joined
11:24 <spatial> readfromarray = do { a <- createarray; liftIO (runReaderT (readvalue 1) a) } writetoarray = do { a <- createarray; liftIO (runReaderT (writevalue 1 2) a) }
11:24 <spatial> In this 'a', the array is shared only if used within the same function ?
11:25 <spatial> No global ?
11:26 rgr joined
11:26 <V3> Unhammer, thanks, done.
11:26 hexagoxel joined
11:27 danza joined
11:27 Einwq joined
11:27 <cads> Hey guys, I've got a bunch of JSON entries and I'd like to extract their schema, build some statistics about the fields, and build some validation/sanity checks into a data consumer
11:27 rixile joined
11:28 jutaro joined
11:28 <Unhammer> :)
11:29 <cads> the data set consists of about 360 json objects, and I've been able to use Jq to extract their path structures and compare them across the data set
11:30 <cads> things are pretty homogenous at the json level, though there is a field that has a somewhat freeform string element which is important
11:31 deepfire joined
11:34 vadivelu joined
11:35 <carter> cocreature: I actually need the new random lib for work. May use test some API stuff first though
11:35 <spatial> I mean in this http://pastebin.com/sUquHU0L. The array reads and writes can happen inside the same functions. Is it possible to share it globally ?
11:35 _sras_ joined
11:36 eklavya joined
11:36 <_sras_> Using attoparsec-bytestring lib, how can I match a NULL value in a bytestring?
11:36 systadmin joined
11:37 JeanCarloMachado joined
11:37 <cads> Example of the unstructured part of the input: https://gist.github.com/maxsu/a64a5ad97c7f36591627abc7be311f21 , as well as my best effort so far in parsing it: https://gist.github.com/maxsu/95a5c12b961cda389ce3b9b3840dba41
11:37 Chobbes joined
11:38 cpennington joined
11:39 ziocroc joined
11:40 <Athas> spatial: in fairness, the type errors when working with monad transformers can be quite horrible.
11:40 <Athas> In general, Haskell isn't in the best place wrt. type errors...
11:40 <cads> This is my data extraction pipeline so far: https://gist.github.com/maxsu/8d47d6cd9e26c3af26d1ea5c35e19abf
11:41 <cads> kinda awful, no?
11:41 FjordPrefect joined
11:41 <Athas> cads: all those unescaped shell variables give me the jitters.
11:41 Iskarlar joined
11:42 <cads> Athas, ach, you're right
11:42 <Athas> Also, put a 'set -e' there or you will have a bad time eventually.
11:43 Iskarlar joined
11:43 Levex joined
11:46 <spatial> Athas: I never figured out anything from the error reports. Too difficult for me.
11:47 <spatial> Just that there was an error :-)
11:47 deepfire joined
11:47 rotcev joined
11:47 harfangk joined
11:48 <kuribas> You learn to read the eventually.
11:49 <kuribas> The problem is that many libraries have convoluted types. Especially lens...
11:49 jomg joined
11:50 <cads> I kinda wish shell variables were self quoting
11:51 <* cads> has swiffered all the non-quoted variables away
11:51 <liste> @hackage shellcheck
11:51 <lambdabot> http://hackage.haskell.org/package/shellcheck
11:52 <liste> not on hackage :(
11:52 <liste> but it's awesome https://www.shellcheck.net/
11:53 netheranthem joined
11:54 <Unhammer> +1 on shellcheck, can no longer live without it
11:55 pickle_ joined
11:57 patbecich joined
11:59 fizruk joined
11:59 <merijn> Is anyone aware of a writeup off persistent's internals somewhere?
11:59 <cads> oh wow
11:59 <* cads> feels fuzzy inside
11:59 [scrooge] joined
12:00 bjz_ joined
12:00 <danza> this seems to be the right link http://hackage.haskell.org/package/ShellCheck
12:00 <cads> grep -rl "#!/bin/bash" | xargs -I % shellcheck %
12:00 pickle_ left
12:01 pleax joined
12:02 Snircle joined
12:02 tsmish joined
12:02 weatherforecaste joined
12:04 Robert__1 joined
12:06 michael3 joined
12:08 freusque joined
12:08 geekosaur joined
12:10 Ch3ck joined
12:11 petermw joined
12:11 pleax joined
12:12 rgr joined
12:12 Levex joined
12:13 rgr joined
12:15 oihdsg joined
12:15 oihdsg joined
12:16 <oihdsg> 9 11 attacks, Did USA do it itself or it just let it happen?
12:16 freusque joined
12:18 defaultnick joined
12:18 vadivelu joined
12:21 cfricke joined
12:21 saurabhnanda joined
12:22 cur8or joined
12:22 michael3 joined
12:23 <M-Magnap2> That's... Incredibly off topic
12:23 Nicnux joined
12:24 <M-Magnap2> If you want a flame war, asks about record syntax instead ;)
12:24 <M-Magnap2> *ask
12:24 dramforever joined
12:24 cur8or joined
12:25 <Athas> M-Magnap2: why? There is only one notation worth fighting for anyway.
12:25 zcourts joined
12:25 <Athas> Haskell records were an inside job.
12:26 chirpsalot joined
12:27 weatherforecaste joined
12:28 mjs2600 joined
12:28 lep-delete joined
12:28 m1dnight_ joined
12:29 Levex joined
12:30 xtreak joined
12:30 <hpc> the iphone was an inside Jobs
12:31 petermw joined
12:31 janos joined
12:33 defaultnick joined
12:33 <maerwald> that pun
12:34 doodlehaus joined
12:35 fizruk joined
12:35 saurabhnanda joined
12:38 systadmin joined
12:40 V3 joined
12:40 pleax joined
12:42 FRP-admin joined
12:43 binnie joined
12:43 janos joined
12:43 FjordPrefect joined
12:44 <mbrock> is there a combinator or pattern for turning a "Lens' s a" and a "Lens' s b" into a "Lens' s (a, b)"?
12:44 moongazer joined
12:44 <_sras_> Is it possible to do IO from within a parser monad in Attoparsec?
12:44 epsilonhalbe joined
12:45 certainty joined
12:45 <osa1> mmm I just sent a PR to a lib that was last updated on 2013
12:45 <merijn> _sras_: No
12:46 <osa1> srbaker_: no
12:46 j2j joined
12:46 <mbrock> ah, I guess I'm looking for "alongside"
12:47 <_sras_> merijn: So what can I do to debug a parser?
12:48 <liste> _sras_: there's Debug.Trace.trace, if it's useful to you
12:48 Chobbes joined
12:49 refold joined
12:50 Argue_ joined
12:51 dramforever joined
12:52 roundhouse joined
12:52 <merijn> Anyone used OpalEye?
12:53 sdothum joined
12:53 <_sras_> merijn: Yes
12:54 janos joined
12:54 <_sras_> liste: Anything bundled with these parser combinators for debugging parsers?
12:55 <merijn> _sras_: Debug.Trace is in base
12:56 FRP-admin joined
12:57 <mbrock> (oops, no, alongside isn't it...)
12:57 defaultnick__ joined
12:57 <Athas> _sras_: just consider yourself fortunate you're not using Happy!
12:57 <Athas> No debugging there.
12:58 janos__ joined
12:58 <merijn> As far as I can tell my options (besides writing raw SQL) are: 1) persistent + esqueletto (Pros: supports streaming, joins, automatic migration. Cons: No flexibility with schema) 2) Groundhog (Pros: Very flexible schema. Cons: no streaming, no joins. Not sure about migration) 3) opaleye (Pros: Flexible schema management, joins. Cons: No migration, doesn't setup tables, no streaming)
12:58 meijiJAPAN joined
12:58 <merijn> Oh, and I forgot the "lacking type safety" for esqueletto
12:59 zeroed joined
12:59 andrei_chiffa__ joined
13:00 Levex joined
13:00 defaultnick__ joined
13:00 bob3434 joined
13:00 <cocreature> writing raw sql is not that bad :)
13:01 <Athas> cocreature: the yak doesn't shave itself.
13:01 <merijn> cocreature: It's not that I dislike writing raw SQL, but then all my type safety goes out the window too
13:02 <cads> hey guys, anyone know where I could find cost/performance comparisons for computer hardware, driven by live data?
13:02 <cocreature> merijn: yeah that’s a fair point.
13:02 <Athas> cads: how do you even measure performance in a comparable way?
13:03 <cads> I'd like to quantify the cost/performance benefit of various tiers of desktop and laptop hardware
13:03 <cocreature> cads: that doesn’t seem to be a haskell question :)
13:03 <merijn> cocreature: It seems odds that besides persistent all the other database libraries only offer queries returning lists, rather than streaming...wanting to deal with huge queries shouldn't be such an odd thing?
13:03 <cads> Athas, I'd be happy with relatively simple metrics - coupling CPUMark results to a laptop's cost
13:03 <cads> cocreature, it's a cohaskell question ;()
13:04 <cads> ;)*
13:04 canta joined
13:04 FRP-admin joined
13:04 <merijn> cocreature: Similarly, the lack of joins in groundhog seems limiting too
13:04 <cocreature> merijn: well persistent on its own is also lacking joins
13:04 <merijn> cocreature: I know
13:04 <merijn> And esqueletto adds joins at the cost of type-safety
13:04 <cocreature> merijn: I’ve never really used any of the higher level libs so I don’t know much about them
13:04 <merijn> It's inadequate compromise all around
13:05 <Athas> Make your own!
13:05 <cads> It /could/ be a haskell question, if the question is how to use haskell to pull CPU benchmark data, computer hardware data, and join the two
13:05 <merijn> cocreature: My basic tests with persistent itself is ok, but it's kinda annoying that you can't represent compound entities in their schema language
13:05 <merijn> Athas: I already have enough yaks
13:05 <cocreature> yesterday I got annoyed when I realized that _none_ of the haskell sql libs can properly work with arrays of composites in postgres
13:06 <robkennedy> On hardware: do I need an Nvidia GPU to use accelerate?
13:06 <Athas> robkennedy: you can also use a CPU.
13:06 <Athas> But NVIDIA GPUs are the only supported GPUs (or accelerator at all).
13:06 <cocreature> accelerate-llvm doesn’t need a gpu iirc
13:06 <merijn> Athas: Adding conduit/pipes support to OpalEye seems the easiest way to get closer to where I wanna be
13:07 <Athas> merijn: already looking for your yak trimmer?
13:07 mjs2600 joined
13:07 <merijn> In the sense that OpalEye has both schema flexibility and joins
13:07 <cocreature> merijn: it seems like opaleye already supports streaming queries in some form https://github.com/tomjaguarpaw/haskell-opaleye/pull/69
13:07 <merijn> Athas: Well, if I fix it once *now*, I won't ever have to do it again if I need to do things in the future!
13:08 Nuub joined
13:08 FRP-admin left
13:09 weatherforecaste joined
13:09 <merijn> cocreature: That's only in opaleye, not opaleye-sqlite
13:09 <merijn> But I guess I could rip the same code off
13:09 <Athas> Accelerate used to support OpenCL, but it's long since bitrotted away: https://github.com/HIPERFIT/accelerate-opencl
13:09 Levex joined
13:09 shayan_ joined
13:09 <cocreature> oh, I wasn’t even aware that opaleye supports something other than postgres
13:10 <merijn> https://hackage.haskell.org/package/opaleye-sqlite
13:10 <merijn> But not sure how much (if any?) it's lagging behind opaleye itself
13:11 <Athas> Why not do everything in pure Haskell? Just load in the data as a bunch of arrays (or lists, if you have plenty of time) and go to town.
13:11 michaelt joined
13:11 <merijn> bah
13:11 <merijn> Last updated in 2015 :\
13:11 andrei_chiffa_ joined
13:11 <cocreature> reinventing relational databases in haskell is definitely a good use of your time
13:12 <merijn> Athas: Because SQLite has many great properties: 1) it's fast 2) it allows me to replace 50k result files with a single database 3) it's robust 4) it's portable to other languages 5) it handles data larger than my RAM
13:12 grayjoc joined
13:13 Berra joined
13:13 <Nuub> Hello everyone! I'm new to Haskell and I was wondering how do you write this without let bindings? let notNull x = not (null x) in filter notNull [[1,2,3],[],[3,4,5],[2,2],[],[],[]]
13:13 sz0 joined
13:14 <cocreature> Nuub: replace filter notNull by filter (\x -> not (null x))
13:14 <merijn> Sadly it looks like opaleye's sqlite support is bitrotted, so that's out too
13:14 <Athas> Nuub: the nice thing about Haskell is that you can always just substitute the definition of a let-bound name where the name is used. (As long as there are no name conflicts.)
13:15 danthemyth joined
13:15 bjz joined
13:17 pleax joined
13:17 jedws joined
13:17 Levex joined
13:17 <merijn> Yak's all around :\
13:18 catsup joined
13:18 <cocreature> I’m accepting bets on when merijn gives up and just uses sqlite-simple
13:19 <merijn> cocreature: More likely: I give up and don't use anything
13:19 <Athas> merijn: don't worry, at least you still have C++ and GPU driver issues to keep you occupied.
13:19 coot joined
13:19 janos joined
13:19 phaji joined
13:19 tomboy64 joined
13:19 aib joined
13:20 <merijn> Naah, my C++ code is mostly solid right now and I don't have to maintain the driver
13:20 <Athas> I have spent a lot of time fighting drivers and rebooting crashed GPUs.
13:21 <Athas> I can't believe people use this stuff in production.
13:21 defaultnick__ joined
13:22 xcmw joined
13:22 <merijn> Athas: Aren't you running code on a cluster maintained by a dedicated admin?
13:22 phaji_ joined
13:22 <Athas> merijn: no. Our IT department installed RHEL on the machines and manage access rights, but I do most of the day-to-day maintenance (and kick them when they fall over).
13:22 <merijn> Didn't ircbrowse have this nice summary of activity in channels?
13:23 <Athas> And I am not a particularly competent systems administrator.
13:23 <merijn> Athas: Ah, we have a dedicated cluster shared by a few universities with a fulltime admin I can just yell at
13:23 catsup joined
13:24 <Athas> Must be nice! Wish we had that. Maybe even a proper job queuing system. A man can dream...
13:24 <merijn> Nothing except the logs seem to work on ircbrowse :\
13:24 <Athas> At least I have root on our machines, so I can just kill everyone when I need to run benchmarks.
13:25 janos joined
13:25 Chobbes joined
13:25 <cads> hey lispy, are you around?
13:25 JeanCarloMachado joined
13:26 <tabaqui1> can I call shell command in haskell template?
13:26 <tabaqui1> I want simple code, alike
13:26 Saizan joined
13:26 <tabaqui1> version = $(exec "git log | head -n 1")
13:27 lithie joined
13:29 <quchen> tabaqui1: System.Process can execute commands, runIO runs IO during TH.
13:29 bjz joined
13:29 <sbrg> and there are probably git libraries to do what you want. if you have your proper version in the cabal file, you can also read the cabal file's version
13:30 <tabaqui1> quchen: yeah, readProcess + runIO
13:30 <tabaqui1> thanks
13:30 <Athas> tabaqui1: https://hackage.haskell.org/package/shqq-0.1/docs/System-ShQQ.html
13:30 defaultnick____ joined
13:30 vadimich joined
13:30 epsilonhalbe left
13:30 <Athas> Then you don't have to fiddle around with TH yourself.
13:30 phaji_ joined
13:31 vadimich joined
13:31 <tabaqui1> last uploaded: 2011
13:31 <tabaqui1> I have to rebuild it manually then
13:31 <tabaqui1> but thx too, I could stole some code from it)
13:31 <chenyu`> quchen: just read about this part in a TH tutorial. "For example, the quotation [| 1 + $(f x) |] will execute (f x) – which must have type Q Exp, translate returned Exp value to literal Haskell code"
13:31 bodisiw joined
13:31 <chenyu`> quchen: http://web.archive.org/web/20100703060856/http://www.haskell.org/bz/thdoc.htm
13:32 phaji__ joined
13:32 phaji_ joined
13:33 lukaramu_ joined
13:33 janos joined
13:33 michaelt joined
13:33 Levex joined
13:34 jomg joined
13:35 <Nuub> cocreature, thanks. Can it be done without lambdas?
13:35 weatherforecaste joined
13:35 <merijn> I don't suppose anyone knows an old mirror of ircbrowse that still works?
13:37 <chenyu`> Nuub: filter (not . null) [......] maybe like this?
13:38 halogenandtoast joined
13:38 phaji__ joined
13:38 <Nuub> chenyu`, thanks :)
13:39 xtreak joined
13:40 oisdk joined
13:40 phaji_ joined
13:40 FullyFunctional joined
13:41 mada joined
13:42 supersixone joined
13:42 supersixone joined
13:43 Boomerang joined
13:47 xall_ joined
13:48 yogsototh joined
13:51 defaultnick__ joined
13:51 bernouli joined
13:52 bob3434 joined
13:52 Chobbes joined
13:54 lonepluto joined
13:54 eschnett joined
13:55 sepp2k joined
13:55 yogsototh joined
13:57 shafox joined
13:58 andrei_chiffa1 joined
13:58 patbecich joined
13:59 suls joined
13:59 michaelt joined
14:01 Kreest__ joined
14:01 orion joined
14:02 _sg joined
14:02 doodlehaus joined
14:04 Detrumi joined
14:04 Shatnerz0 joined
14:07 doodlehaus joined
14:07 yqt joined
14:08 phaji_ joined
14:08 pleax joined
14:09 OnkelTem joined
14:09 doodlehaus joined
14:10 danza joined
14:12 weatherforecaste joined
14:12 Copperis joined
14:13 hololeap joined
14:19 danthemyth joined
14:19 robertkennedy joined
14:20 mizu_no_oto_work joined
14:20 luis3m joined
14:21 andrei_chiffa__ joined
14:22 mbw joined
14:25 <spatial> Trying once more. Have the code http://pastebin.com/sUquHU0L How does a function that writes pass the updated array to another ? Not getting it.
14:25 cdg joined
14:26 <spatial> I have some lisp code and I convert that. Seems functions try to access shared array. (defvar value-table)
14:26 weatherforecaste joined
14:26 dsh joined
14:26 <Athas> spatial: you need to use just one monadic action: readandwritefromarray = do { a <- createarray; liftIO (runReaderT (do {writeValue 1 2; readvalue 1}) a) }
14:26 <Athas> (Although hopefully with more linebreaks.)
14:26 meba joined
14:27 Gurkenglas_ joined
14:28 <spatial> Yes. But then http://pastebin.com/G3QAQemD lisp seems different.
14:28 mekeor joined
14:28 <Athas> Yes, because in Lisp you can have implicit global mutable variables.
14:28 <Athas> That doesn't fly in Haskell. You use monads to precisely describe the context in which the side-effects occur.
14:29 <spatial> Ok. Refactor ?
14:29 <Athas> Yes.
14:29 aj1 joined
14:29 ChristopherBurg joined
14:30 SpinTensor joined
14:31 magneticduck joined
14:32 ystael joined
14:32 Jicoss joined
14:32 luis3m` joined
14:36 luis3m` left
14:36 defaultnick__ joined
14:36 weatherforecaste joined
14:37 phaji__ joined
14:37 alx741 joined
14:38 gcross joined
14:38 bezirg joined
14:38 guampa joined
14:39 JanBessai joined
14:39 saurabhn_ joined
14:40 yumh joined
14:42 defaultnick__ joined
14:43 <lpaste_> bezirg pasted “ScopedTypeVariables question” at http://lpaste.net/353269
14:43 coltfred joined
14:44 oisdk joined
14:44 <bezirg> can anybody explain me why http://lpaste.net/353269 that uses ScopedTypeVariables does typecheck?
14:44 phaji_ joined
14:45 luis3m` joined
14:45 <lyxia> bezirg: line 20; let o2' = o2
14:45 <lyxia> line 24; let o2' = o2'
14:46 roundhouse joined
14:46 rgr joined
14:47 <bezirg> lyxia: omg, thanks for spotting this, I thought something was wrong with ScopedTypeVariables :)
14:47 <lyxia> you're welcome
14:47 rekahsoft joined
14:48 <nitrix> I thoughti t was intentional and trying to figure out the isomorphism here x]
14:49 luis3m` left
14:51 cur8or joined
14:51 Levex joined
14:52 xtreak joined
14:53 `^_^v joined
14:54 xtreak joined
14:54 AndreasK joined
14:55 asdfga joined
14:55 asdfga left
14:55 joneshf-laptop joined
14:56 xcmw joined
14:56 luis3m joined
14:56 refold joined
14:56 brynedwards joined
14:57 [scrooge] joined
14:58 chlong__ joined
14:58 <ij> Will one be able to write some types of code that depend on bytestring/string/text only once with backpack?
14:59 vadimich_ joined
14:59 <lyxia> isn't that the point of it?
14:59 zeroed joined
14:59 happy0 joined
15:00 <* ij> is just making sure he got it right.
15:00 xtreak joined
15:00 tommd joined
15:02 <lyxia> ij: Okay. That sounds right to me.
15:03 roundhouse joined
15:03 Chobbes joined
15:03 osa1 joined
15:04 tsmish joined
15:04 <lyxia> ij: We can already sort of do that with type classes but it's not very modular, see comments at the bottom http://blog.ezyang.com/2016/09/the-base-of-a-string-theory-for-haskell/
15:06 schjetne joined
15:07 <spatial> Is there a return type to signify void ?
15:07 <sbrg> spatial: there is Void, a type with no inhabitants
15:07 <spatial> State is changed but the functions doesn't explicitly return
15:07 <sbrg> which means you can't return anything but undefined
15:08 <sbrg> return unit?
15:08 <sbrg> ()
15:08 <sbrg> that is the traditional way
15:08 <spatial> return ()
15:09 MitchW joined
15:09 <spatial> declaration is :: ()
15:09 sdxxqa joined
15:10 will11 joined
15:11 JanBessai joined
15:12 schjetne joined
15:12 Yttrill joined
15:14 raycoll joined
15:14 Chobbes joined
15:14 cschneid_ joined
15:15 <lyxia> yes, you return something which carries no information, which is the equivalent of not returning anything in imperative languages.
15:17 <Yttrill> hi, can anyone help me convert a small function to use unboxed ints?
15:17 eacameron joined
15:20 <cocreature> Yttrill: it’s hard to see answer that question without seeing the function :)
15:20 <Yttrill> import System.IO n = 13 main = do (print n) (print (ack 3 n)) ack :: Int -> Int -> Int ack 0 n = n + 1 ack m 0 = ack (m - 1) 1 ack m n = ack (m - 1) (ack m (n - 1))
15:21 <Yttrill> hmm
15:21 <cocreature> @where lpaste
15:21 <lambdabot> http://lpaste.net/
15:21 <cocreature> use that for posting your code
15:21 al-damiri joined
15:21 <lyxia> why do you want to unbox this
15:21 chirpsalot joined
15:21 <Yttrill> because its too slow
15:21 <cocreature> have you compiled with optimizations?
15:21 <Yttrill> 5 times slower than C
15:21 <Yttrill> yes
15:22 <Yttrill> ghc 7.10
15:22 <lyxia> First add strictness annotations
15:22 roundhouse joined
15:23 <Yttrill> http://lpaste.net/353271
15:23 roundhouse left
15:23 andrei_chifa joined
15:23 nick_h joined
15:24 <cocreature> yeah add a strictness annotation to the second argument
15:24 sirmob joined
15:24 raycoll joined
15:24 <Yttrill> how
15:24 <Yttrill> sorry i'm just learning Haskell
15:24 <shapr> I feel that way too
15:24 <Yttrill> this is in a performance comparison
15:25 <cocreature> you are probably not going to beat C if that’s your goal
15:25 <shapr> I like comparing time to write code that solves a problem among languages.
15:25 <shapr> For me, Haskell almost always wins that performance comparison.
15:26 kosorith joined
15:26 fendor joined
15:26 lenstr joined
15:27 Boomerang joined
15:27 tommd joined
15:28 <Yttrill> i just want a fair comparison, C, Felix, Ocaml, Haskell
15:28 <Yttrill> without optimisations Haskell takes over 2 minutes
15:28 <Yttrill> with -O2 15 seconds
15:28 Guest77462 joined
15:29 <Yttrill> Ocaml does 4 seconds
15:29 <Yttrill> clang 3.8
15:29 <Yttrill> and gcc 2.2
15:29 <Yttrill> the original code use Int#
15:30 <Yttrill> but it didn't work on 7.10 so i removed the unboxing
15:30 <shapr> Yttrill: Have you benchmarked hand written assembly?
15:30 <Yttrill> nope
15:31 mr_sm1th joined
15:31 StarsC joined
15:31 <Tuplanolla> Read up on `BangPatterns`, Yttrill.
15:31 <Yttrill> yeah, i just looked at BangPatterns, is that in 7.10?
15:31 <Tuplanolla> Yes. It has been around forever.
15:32 <Yttrill> i could perhaps upgrade to 8 but i'm using OSX Sierra ..
15:32 shafox joined
15:32 <cocreature> looks like bang patterns don’t help
15:32 CoconutC1ab joined
15:32 saurabhnanda joined
15:32 <cocreature> unboxing won’t help either since ghc already unboxes this
15:32 <cocreature> one thing you could try is using the llvm backend but I don’t have the right llvm version installed to do so
15:33 defaultnick____ joined
15:33 sword865 joined
15:33 eklavya joined
15:34 <StarsC> why cabal has docs disables by default?
15:34 Rainb joined
15:34 wtetzner joined
15:34 <dramforever> cocreature: *Exactly* what I did a few seconds ago
15:34 <dramforever> -fllvm, oh well it doesn't work
15:35 <Yttrill> so its already unboxed?
15:35 <cocreature> Yttrill: yep
15:35 <dramforever> Yttrill: yes, you can check by passing -ddump-simpl
15:35 <Yttrill> ouch
15:35 <dramforever> (-fforce-recomp also helps when playing)
15:35 <dramforever> So, conclusion: Haskell sucks at computing ack
15:35 <Yttrill> yep i found that
15:36 <cocreature> dramforever: I already have 3 different llvm builds installed. I’m too lazy to have another one for ghc :)
15:36 <shapr> Is that a real world test?
15:36 Boomerang joined
15:36 <Yttrill> no its a stupid micro test
15:36 <cocreature> llvm would probably be worth the effort if you are really keen on getting this example fast
15:37 <Yttrill> you mean make ghc generate LLVM code?
15:37 <Yttrill> instead of C?
15:37 <cocreature> ghc does not generate C, it has it’s own code generator
15:37 <dramforever> It doesn't generate C really
15:37 <cocreature> but yeah make it use llvm instead
15:37 <cocreature> you can do so by passing -fllvm
15:37 <dramforever> cocreature: You handle this, goodbye :P
15:37 <Tuplanolla> It used to generate C.
15:37 freechips joined
15:38 <dramforever> That's like forever ago
15:38 <Tuplanolla> Indeed.
15:38 <Tuplanolla> Still, the documentation won't die.
15:38 <dramforever> -fvia-C is already dead
15:39 cschneid_ joined
15:39 cschneid_ joined
15:39 <Yttrill> ok it can't figure llvm version
15:39 skeet70 joined
15:39 <Yttrill> i wonder where it lives ..
15:40 ub joined
15:40 sid_fules joined
15:41 <Yttrill> Apple LLVM version 8.0.0 (clang-800.0.42.1)
15:41 <Yttrill> how do i tell ghc where llvm is?
15:42 weatherforecaste joined
15:42 mjs2600 joined
15:42 amf joined
15:44 danza joined
15:44 coot joined
15:44 <StarsC> why people dont use https://gitter.im/haskell-chat/Lobby? u can post code directly in chat
15:45 <StarsC> seems more advanced than irc
15:45 <quchen> Yttrill: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/flags.html#replacing-phases
15:45 simukis__ joined
15:45 AzurTek joined
15:45 <shapr> StarsC: same reason windows is still popular, it's hard to unseat an incumbent with an active community.
15:46 coltfred joined
15:46 simukis__ joined
15:46 <StarsC> i know that many people from here use gitter
15:46 V3 joined
15:47 <StarsC> but majority seems not
15:47 saurabhn_ joined
15:47 certainty joined
15:48 mjs2600 joined
15:48 <luis3m> I like chatting in my Emacs editor, but as you say gitter is better to post code and stuff
15:50 <StarsC> also gitter seems to be more community oriented, you can go and look at people work by clicking on their picture
15:51 <Tuplanolla> Where's the source code to their server, StarsC?
15:51 <StarsC> gitter?
15:51 <cocreature> good luck trying to convince the 1538 people in here to move to gitter
15:51 <Tuplanolla> Yes, StarsC.
15:51 <StarsC> Tuplanolla: i did not know its not opensource
15:52 <StarsC> cocreature: i up if people will write haskell clone of irc with all good features
15:52 <luis3m> Cool, I'm gonna join there as well.
15:52 FullyFunctional left
15:52 <StarsC> cocreature: just saying irc is outdated, there is irc, haskell-maillist , twitter, github
15:52 <StarsC> hard to follow
15:53 Nihil joined
15:53 <cocreature> StarsC: sure irc is outdated. but it somehow works and people use it
15:53 <cocreature> twitter & github are completely different things
15:53 <StarsC> well lets make new one?
15:53 tommd joined
15:53 <Tuplanolla> All the improvements are either proprietary or garbage, so IRC lives on.
15:53 <shapr> There have been many new IRCs, I haven't seen any huge successes.
15:53 thunderrd joined
15:53 rixile joined
15:53 wraithm joined
15:54 <srk> hehe, slack even has IRC gateway :D
15:54 <StarsC> Tuplanolla: whats wrong with posting code? or maintaining proper profiles of community users?
15:54 <shapr> I think IRC has the sweet spot of being extremely simple and using DCC for additional features.
15:54 <Tuplanolla> The lack of support for equations and a user interface that's not a 200 MB JavaScript abomination for example, StarsC.
15:54 <shapr> ooh, inline LaTeX would be awesome
15:55 <StarsC> Tuplanolla: good point, so why u still think irc is good?
15:55 <shapr> I also wish for messages longer than 512 chars
15:55 wraithm_ joined
15:55 <Tuplanolla> I don't, but it's good enough to stay relevant, StarsC.
15:55 <amf> are there any good libraries for helping one generate random data? is this something quickcheck is suited for?
15:55 <cocreature> I doubt anybody argues that IRC doesn’t have problems. they are just not big enough for people to move away from it
15:56 <shapr> amf: yes, there are haskell wiki articles on using quickcheck to generate random data for testing java, etc
15:56 honeymead_ joined
15:56 <Yttrill> kak .. ok i have to compile LLVM to make haskell go fast :-(
15:57 <StarsC> Tuplanolla: i guess in this way of thinking email is more relevant than irc
15:57 <Tuplanolla> That's true.
15:57 <shapr> Yes, I agree with that.
15:58 <shapr> StarsC: I tried to make a multi-user pair programming web app in Haskell, for teaching on #haskell, but it didn't get popular in the Haskell community.
15:58 Unhammer joined
15:58 <StarsC> shapr: is it on hackage?
15:58 <shapr> StarsC: if you like the sort of features that gitter has for pasting code, fpcomplete's IDE did way more cool stuff, it was closer to a shared jupyter notebook for Haskell (with state and auth)
15:59 <shapr> StarsC: yes, but last updated 2012
15:59 <StarsC> nice
15:59 <StarsC> but fpcomplete closed its haskell school?
15:59 srbaker_ joined
15:59 <StarsC> i mean online ide
16:00 patbecich joined
16:00 defaultnick___ joined
16:00 pleax joined
16:00 <shapr> The previously created articles are still available, but I think creation of new articles has been disabled.
16:00 <shapr> I'd love to host that IDE on my own server.
16:00 <shapr> for my own use
16:01 cschnei__ joined
16:01 Levex joined
16:01 athan joined
16:02 <StarsC> are there any emacs multi user editing capabilities?
16:02 <shapr> StarsC: yes, but rarely used
16:02 tsahyt joined
16:03 danthemyth joined
16:03 <shapr> StarsC: I haven't tried those multi-user editing libraries lately, I couldn't find anyone who wanted to pair with me across the internet :-(
16:04 <Yttrill> how big is an Int in ghc? (on x86-64)?
16:04 janos joined
16:05 <tsahyt> Hello. I want to implement a function that works for all types (contained in a particular functor) but if it happens to be one specific type, it should act slightly differently. How would I got about solving this? I suppose I can just provide two versions of the function but maybe there's some nifty typeclass hackery I can put to work here
16:05 mda1 joined
16:06 janos__ joined
16:06 <shapr> Yttrill: pretty sure it's 64bits
16:06 <shapr> tsahyt: sounds like a typeclass thing to me
16:07 <Yttrill> 64 bits would explain the performance issue
16:07 <tsahyt> shapr: but I would end up with overlapping instances I think
16:07 <tsahyt> although right now I'm not getting even a warning.. hmm
16:07 nemorichard joined
16:08 <tsahyt> ah, they appear on use
16:08 janos___ joined
16:08 cosmodanger joined
16:08 boombanana joined
16:08 <tsahyt> I'd somehow have to express instance a !~ T => C a, with !~ meaning that it does *not* unify
16:09 <tsahyt> but afaik that's not possible
16:10 michaelt joined
16:10 <Yttrill> ooo .. if i change C to use int64_t its 17 seconds .. ghc is faster now
16:10 xtsaqc joined
16:10 <Yttrill> ah no i forgot -O2 ;(
16:11 <Yttrill> still 4 seconds for C
16:11 <Tuplanolla> You probably won't see GHC beat GCC in microbenchmarks such as this one, Yttrill.
16:11 Deide joined
16:11 zcourts joined
16:11 xall_ joined
16:11 wtetzner joined
16:11 <Yttrill> ackman is dependent entirely on how many words go on the machine stack
16:11 <Tuplanolla> The real benefits come in at larger scale via sharing and fusion.
16:12 Luke joined
16:12 doodlehaus joined
16:12 defaultnick_ joined
16:12 <Yttrill> one can share stuff in C too
16:13 <Yttrill> fusion should be a big win tho
16:13 <Tuplanolla> You can do anything in C.
16:13 <Yttrill> neither Felix nor Ocaml can do that AFAIK
16:13 janos joined
16:13 <iainhallam> Anyone know why GHC has precompiled binaries for CentOS 6.7 but not CentOS 7, which is now nearly three years old?
16:13 <Yttrill> well, in C you have problems with memory management
16:14 <Yttrill> actually i'm trying to see how fast my own language is :)
16:14 <iainhallam> Or, for that matter, what the difference between the Debian 7 version (which works on CentOS 7) and the Debian 8 version?
16:14 <tsahyt> hmm, okay with an overlaps pragma it works at least for a simple test
16:14 <iainhallam> They both say compiled against libgmp.so.10.
16:14 fenris joined
16:15 fenris joined
16:15 <unclechu> hey guys, i wan't to make my first library that i'm going to publish to hackage, any tutorials you could recommend me to read first? how do i test it for different ghc versions?
16:16 AndreasK joined
16:16 V3 joined
16:16 <unclechu> now i usually use stack and don't even specify packages versions in `*.cabal` file and let stack-lts provide it
16:16 <Guest88422> test
16:17 <tsahyt> oh, maybe this even works properly with overlapping instances
16:17 <unclechu> in case where i develop a public library i should specificy ranges of acceptable versions i guess
16:17 raichoo joined
16:17 <cocreature> unclechu: https://github.com/hvr/multi-ghc-travis is great for testing against multiple ghc versions
16:17 <unclechu> cocreature: thanks
16:18 cobreadmonster joined
16:19 sellout- joined
16:19 <tsahyt> I guess it does. so in my case I have a instance C a, and a single instance C T, which is always the most specific instance for T.
16:19 <tsahyt> nice, and the class constraint I have to introduce even serves some documentative purpose
16:20 cdg_ joined
16:20 paolino_ joined
16:21 serendependy joined
16:21 V3 joined
16:21 <StarsC> unclechu: please write good docs and at least ONE example :)
16:22 <unclechu> StarsC: of course, i'll try my best :)
16:22 rgr joined
16:22 aarvar joined
16:22 tlaxkit joined
16:23 freusque joined
16:24 <EvanR> please write more than just one example, more than examples
16:24 <EvanR> like, write words
16:24 janos__ joined
16:24 aglorei joined
16:24 Gurkenglas_ joined
16:25 janos__ joined
16:25 V3_ joined
16:26 owiecc joined
16:26 hackebeilchen joined
16:26 suica joined
16:27 freusque joined
16:27 xcmw joined
16:27 <cocreature> EvanR has the best words
16:28 Tariskun joined
16:28 guampa joined
16:29 srbaker_ joined
16:29 negatratoron joined
16:29 <suica> I'm trying to understand `once` as it's defined here: http://neilmitchell.blogspot.com/2012/06/flavours-of-mvar_04.html -- recreated here http://lpaste.net/353272 using plain MVars.
16:30 `^_^v joined
16:30 _sg joined
16:30 defaultnick_ joined
16:30 bennofs1 joined
16:31 <suica> firstly, why can't the signature be `IO a -> IO a`? do you need the wrapper IO to create the enclosed MVar?
16:31 nakal_ joined
16:32 JeanCarloMachado joined
16:32 trism joined
16:32 janos joined
16:32 fendor joined
16:34 <cocreature> suica: if you use IO a -> IO a it would need to execute the action immediately. using IO (IO a) allows passing an action back to the caller and leaving it up to him if and when it is called
16:34 JagaJaga joined
16:34 pleax joined
16:35 loanatic joined
16:35 weatherforecaste joined
16:37 jathan joined
16:37 <ski> suica : the outer `IO' in `IO (IO a)' is required because of the `newVar'. the inner is required to modify it, to manipulate the `Barrier', and to execute the input action
16:38 <suica> cocreature: makes sense. is it not possible to write `once'` that lets you do `do { let g = once' f; x <- g; y <- g; ... }` with the behavior of `once`?
16:38 andrei_chifa joined
16:38 raycoll joined
16:38 <suica> cool, that makes sense
16:39 <saylu> Hey folks!
16:39 <saylu> I’ve been searching for inspiring & interesting Haskell code, talks, and writing lately and I thought you all would have some favorites.
16:39 <saylu> I’d love to hear about any Haskell stuff that’s inspired you before!
16:39 shafox joined
16:40 <saylu> Here’s good, and I also made a thread on /r/haskell that I’ll copy responses over to unless you’d like to just post there
16:40 <saylu> https://www.reddit.com/r/haskell/comments/5xtrq6/inspiring_code_talks_papers_and_writing_in_haskell/
16:40 <magnap> suica: If you'd accept `g <- once f` you could probably use some kind of forcing, if I'm understanding you correctly
16:40 janos joined
16:40 weatherforecaste joined
16:40 <ski> suica : `let g = once' f' doesn't work since it needs to allocate a `Var', so there must be an outer action
16:40 loanatic joined
16:40 Levex joined
16:41 henriksod joined
16:41 Tariskun joined
16:41 xxpor joined
16:41 <shapr> saylu: https://github.com/glguy/advent2016 solutions for http://adventofcode.com/2016/
16:41 <suica> thanks, makes sense. was going to ask why I couldn't manage to generalize `once` to `Monad m => m a -> IO (m a)` but I get it now
16:42 <saylu> thanks shapr!
16:43 ludat joined
16:45 le_frogballs joined
16:45 bodisiw joined
16:46 Adeon joined
16:46 janos joined
16:47 janos__ joined
16:48 <tsmish> Yttrill, looks like your program allocates lot of memory. It literally spends 90% time in GC. Can anyone explain this to me.
16:48 <suica> ski: what's the reason for the `return $ join $ modifyMVar` in `once` instead of just `modifyMVar` (which is the same type)? don't really understand his explanation.
16:49 fre2 joined
16:49 <le_frogballs> Is there a way to do package imports in Haskell as you would in Scala? I don't want to have to import everything I need manually in every file
16:49 janos__ joined
16:49 urodna joined
16:50 <cocreature> le_frogballs: you can make modules that reexport other modules to accomplish something similar but there is nothing that no way to accomplish this directly.
16:50 comboy joined
16:50 <le_frogballs> cocreature: yea that was the hack I was planning on doing
16:51 <ski> suica : the `modifyVar var (...)' has type `IO (IO (...))', the outer `IO' represents modifying the mutable cell referenced by `var', the inner `IO' represents an inner I/O action (involving barriers and executing `act') which results from reading that mutable cell
16:51 defaultnick____ joined
16:51 <ski> suica : we want to perform both of these two "layers", one right after the other -- hence the `join'
16:52 <ski> suica : then the `return' means that the resulting I/O action isn't to be performed immediately, but only when the executer of `once' decides to subsequently execute this computed I/O action
16:52 <tsmish> Looks like I misunderstood output, sorry.
16:56 Jacoby6000_ joined
16:57 <suica> ski: thanks, makes sense. so if you removed the `return $ join $` it would still typecheck, but the resulting `IO (IO a)` when executed would fill the outer MVar and return an action which, when executed, fill the barrier and return `x` (the first time) and then block forever on subsequent executions?
16:57 jmelesky joined
16:58 jomg joined
16:58 <ski> suica : something like that, i suppose (i didn't keep track of the details of how `once' is supposed to do its job)
16:58 robotroll joined
16:59 <ski> suica : with `IO (IO (...))' we "monadically" return a callback action (i.e. the caller will use it later to callback into code given by the callee)
17:00 <ski> (as opposed to "input callbacks", where the caller is providing some code that the callee (or someone it delegates responsiblity to) will call back into)
17:00 BlueRavenGT joined
17:01 aglorei joined
17:02 <suica> ski: thanks, it's a lot clearer to me now!
17:03 <ski> np
17:03 conal joined
17:03 weatherforecaste joined
17:04 roconnor joined
17:04 vF3hNGxc47h8 joined
17:05 carlomagno joined
17:05 oisdk_ joined
17:05 <koala_man> liste: shellcheck is on hackage with a case sensitive url: http://hackage.haskell.org/package/ShellCheck
17:06 cdg joined
17:07 sternmull joined
17:07 uglyfigurine joined
17:07 Thra11 joined
17:07 conal joined
17:07 Tariskun joined
17:11 mr_sm1th joined
17:12 wraithm joined
17:13 justan0theruser joined
17:13 zdenal joined
17:13 Sonolin joined
17:14 ptvirgo joined
17:15 zar joined
17:15 Geraldus joined
17:17 <Geraldus> Hi folks!
17:18 <Geraldus> Does anyone knows how to configure Apache2 to redirect some requests to Keter?
17:18 tommd joined
17:19 JagaJaga joined
17:19 <unclechu> StarsC: what do you think, is this readme good enough? https://github.com/unclechu/haskell-qm-interpolated-string did i missed something?
17:20 ozgura joined
17:20 grwoith joined
17:20 simendsjo joined
17:21 mekeor joined
17:21 AyyLamo joined
17:23 <suica> ski: so I modified `once` a bit to add a non-blocking lookup before the blocking `modifyMVar` -- would you mind taking a quick look? http://lpaste.net/353274 I purposefully kept the `Nothing` check inside the `modifyMVar`.
17:23 <sdrodge> Anyone willing to look at my code for this hackerrank problem: https://www.hackerrank.com/challenges/messy-medians and tell me how it could be done better? https://hastebin.com/ulewutuwey.hs
17:23 Tariskun joined
17:24 revtintin joined
17:24 Jicoss joined
17:25 Tariskun joined
17:27 weatherforecaste joined
17:30 <chenyu`> Oh, this hackerrank is what I am looking for.
17:30 oisdk joined
17:30 defaultnick_ joined
17:30 schjetne joined
17:30 <chenyu`> A haskell leetcode
17:30 <chenyu`> cool
17:31 hiptobecubic joined
17:31 raichoo joined
17:31 chetshah_ joined
17:32 conal joined
17:32 Lord_of_Life joined
17:32 <chetshah_> Hello all, haskell beginner here, Just saw this definition of fix in haskell wikibook : fix f = let {x = f x} in x, was wondering if the curly braces have some meaning?
17:33 <kuribas> chetshah_: yes, they delimit the substatement.
17:33 doomlord joined
17:34 <kuribas> chetshah_: well, substatements. But alternatively, you can use the layout rule.
17:34 <kuribas> chetshah_: what the layout rule does, is just insert curly braces based on indentation.
17:34 beanbagula joined
17:34 <benzrf> chetshah_: they are not strictly necessary there; that particular case works without em
17:34 <chetshah_> kuribas you mean escape hatch for layout rules ?
17:35 tommd joined
17:35 <kuribas> benzrf: because of the layout rule.
17:36 <geekosaur> chetshah_, more practically, you need the braces there if you're combining stuff into a single line for ghci (or lambdabot) and the let is inside another layout-inducer like do
17:36 <geekosaur> because let can do more than one binding at a time and the language can't tell when the binding list for let ends and the do resumes
17:36 <kuribas> chetshah_: the braces are part of the "real" syntax, the layout rule is a convenience.
17:36 Matajon joined
17:37 contiver_ joined
17:37 nick_h joined
17:37 gehmehgeh joined
17:37 <monochrom> layout is escape hatch for the {;} rules.
17:38 <chetshah_> Ah.. that makes sense. Thanks all. Was hard to find this on googling though. Guess I would find more under indentation section.
17:39 fizruk joined
17:39 sgflt joined
17:40 moongazer joined
17:40 mekeor joined
17:40 jathan joined
17:42 afarmer joined
17:43 reuben364 joined
17:45 cdg_ joined
17:48 defaultnick_ joined
17:50 ozgura joined
17:50 bollu joined
17:51 Boomerang joined
17:51 bodisiw joined
17:52 <kuribas> What do you use for debugging?
17:52 <kuribas> Debug.Trace?
17:53 <bollu> is there a way to "create a pattern match" from a lens? something of the form, "if a.b.c.d == val, allow this lens to match"
17:53 TheEpsylon joined
17:54 Kreest_ joined
17:54 louispan joined
17:54 <bollu> I have a deep structure, on which I want to perform an operation only if its shape looks like something I know
17:54 cdg joined
17:55 <mnoonan> bollu: you know about view patterns?
17:55 iomonad joined
17:56 <bollu> mnoonan: oh, right, the syntax extension :)
17:56 <bollu> mnoonan: pretend I don't know
17:56 <bollu> mnoonan: could you tell me how they could be used here?
17:56 <mnoonan> well, I'm not entirely clear on what you want to do :)
17:57 JeanCarl1Machado joined
17:57 connrs joined
17:57 <kuribas> bollu: why not use normal pattern matching?
17:57 <geekosaur> I think the point is that the only pattern they have is the lens
17:57 <geekosaur> which sounds like a view pattern using has to me
17:58 <bollu> kuribas: a little too unweildy
17:58 <geekosaur> ...or just a guard for that matter, unless they also want the deconstruction behavior
17:58 ystael joined
17:58 <kuribas> bollu: in that case view patterns or pattern synonyms are your friend.
17:59 <geekosaur> actually has is the guard, one of the ? variants for lens matches for view pattern so you get a Maybe
17:59 <geekosaur> bleh
18:00 <bollu> kuribas: it looks like this:
18:00 <bollu> case closure of
18:00 <bollu> Closure {
18:00 <bollu> lf @ _lambdaForm =
18:00 <bollu> LambdaForm{
18:00 <bollu> _lambdaShouldUpdate = False
18:00 <bollu> }
18:00 <bollu> } -> stepEnterIntoNonUpdateableClosure lf
18:00 <bollu> I want to simplify the mess
18:00 <bollu> I don't think that will even compile :P
18:00 <bollu> I see
18:00 <bollu> but I hope the intent is clear
18:00 <bollu> if the internal structure looks like so, hand over the lambdaForm
18:00 <bollu> Gurkenglas_: hey
18:00 <kuribas> bollu: use a pastebin
18:00 <kuribas> like lpaste
18:01 patbecich joined
18:01 alx741 joined
18:01 replay joined
18:02 norotartagen joined
18:02 <kuribas> bollu: that doesn't look like haskell...
18:02 Luke joined
18:03 phyrex1an joined
18:03 <byorgey> kuribas: it is =)
18:03 <geekosaur> it is, just oddly laid out
18:03 <geekosaur> probably from the paste
18:03 <geekosaur> (again, reasons to use a paste site...)
18:03 <kuribas> what's the "=" doing there?
18:04 <geekosaur> it's a record-syntax pattern match, in a case
18:04 <geekosaur> Constructor {aspattern @ fieldname = bindname}
18:04 bollu joined
18:05 <kuribas> is that an extension?
18:05 <geekosaur> no?
18:05 <geekosaur> it's not the most common construct in the langaiuge but I use various pieces of it fairly regularly
18:05 <kuribas> strange, I haven't seen that before...
18:06 <Tuplanolla> I thought the name would come to the right of `=`.
18:06 <geekosaur> also I'm not sure what point the as-pattern has there, but.
18:07 nick_h joined
18:07 <lpaste_> bollu pasted “ungainly-pattern-match-can-lensify?” at http://lpaste.net/353275
18:07 Nicnux joined
18:07 Igloo joined
18:07 <bollu> geekosaur, kuribas: ^
18:08 <geekosaur> myKeys XConfig {modMask = modm} = fromList [ ... keybinds using modm as the KeyMask ... ] :p
18:08 <geekosaur> (granted there's a reaosn we strongly recommend additionalKeysP these days...)
18:09 sobaken joined
18:09 defaultnick____ joined
18:10 <contiver_> I just realized there is no liftA4, so I ended up using liftM4. Any particular reason for that?
18:10 <bollu> kuribas, geekosaur: how would I use ViewPatterns for this?
18:11 <bollu> contiver_: why not do-notation at that point? or <$> <*> … ?
18:11 <geekosaur> nobody thought it was needed? and liftA<n> is just a chain of <$> ... <*> ... <*>
18:11 calincru joined
18:12 <Tuplanolla> We should totally have a `liftAN` splice for completeness.
18:12 wraithm joined
18:12 dedgrant joined
18:13 oish joined
18:13 <bollu> mnoonan: how do I ViewPatterns this?
18:13 <kuribas> I would write something like this: myFun closure | lf <- _closureLambda closure, _lambdaShouldUpdate lf == False = stepEnter... lf | otherwise -> error ...
18:13 <contiver_> bollu: I could do that, but then I'd either have more lines, or it would go further to the right. In other words, just personal taste.
18:13 <bollu> contiver_: I think a ViewPattern would carry intent better?
18:14 <contiver_> I just expected there would be a liftA4, being there a liftM4 already.
18:14 <bollu> contiver_: like, "this is a non updatable closure"
18:14 <kuribas> bollu: I'd only use a pattern synonym when I have the same pattern many times.
18:14 <bollu> kuribas: oh, I see
18:14 <bollu> kuribas: hm
18:14 <bollu> kuribas: I don't know how often this comes up
18:14 <geekosaur> contiver_, things like liftM4 are historical... and not very widely used
18:14 <bollu> I am implementing STG for understanding
18:14 <bollu> if quchen was around, he would know
18:15 mbeidler joined
18:15 <geekosaur> so there's a fair amount of "...do we really need this?", akin to how there's 15 tuple instances for any typeclass that can take a tuple and a;most nobody uses anything bigger than a 3-tuple or the occasional 4-tuple
18:16 matchwood joined
18:16 <geekosaur> (historical = that was before someone figured out they could use liftM and `ap` instead of having to have umpteen different liftMn-s)
18:16 michaelt joined
18:17 <geekosaur> (which was how we spelled <$> and <*> in the monad version, which predated Applicative by like a decade or so)
18:17 <contiver_> geekosaur, yes, I get what you mean, monads came before than applicative, and hence both APIs share much.
18:17 <geekosaur> but more than that, liftMn for n > 2 is itself predating the generalized version
18:18 <geekosaur> whereas Applicative always had the generalized one
18:18 raycoll joined
18:18 <geekosaur> and tbh I;ve never needed more than liftM3 / liftA3
18:18 <bollu> geekosaur: do you know the "actual" main type before IO? I am told it was [Input] -> [Output], but is that true?
18:19 _sg2 joined
18:19 <geekosaur> [Response] -> [Request]
18:19 <kuribas> bollu: there is filtered from lens, but it may not give a legal lens...
18:19 <dmwit> http://hackage.haskell.org/package/data-aviary-0.2.3/docs/Data-Aviary-Birds.html is pretty funny =)
18:19 <geekosaur> the initial Response had argv in it
18:19 <kuribas> :t filtered
18:19 <lambdabot> (Choice p, Applicative f) => (a -> Bool) -> Optic' p f a a
18:19 <geekosaur> among other things
18:19 <bollu> geekosaur: um, response to requests?
18:19 <bollu> geekosaur: explain that a bit please?
18:19 caumeslasal joined
18:20 <Tuplanolla> The runtime system has the other order, bollu.
18:20 <Tuplanolla> It's like a server--client relationship.
18:20 <geekosaur> yes, you receive a Response from the OS (again, the initial one was the command line parameters) and produce Request-s to the OS for I/O. both were lazy lists
18:20 <bollu> ah
18:20 <bollu> dang
18:20 <bollu> that is quite cool
18:20 <Tuplanolla> Yeah, until you actually use it.
18:20 <bollu> is there some way to "go back" to that style of programming?
18:20 <bollu> xD
18:20 <dmwit> bollu: `Request` was an ADT with things like `PutStrLn :: String -> Request`, `GetLine :: Request`. `Response` was an ADT with things like `GotALine :: String -> Response`.
18:20 <bollu> Tuplanolla: what were the pain points?
18:20 <Tuplanolla> I didn't use Haskell back then.
18:21 owiecc joined
18:21 <geekosaur> it's "cool" in the "neat hack" sense. I'd rather beat my head against a brick wall than actually *write* to it...
18:21 <dmwit> Pain points: your response consumption must be kept in synch with your request generation, or else you start reading responses to a different request than the one you sent.
18:21 <sdrodge> It's all fun and games until you accidentally force the input list too hard and get a deadlock.
18:21 <dmwit> Responses are completely untyped; even though you know `GetLine` should always respond with `GotALine s`, you still have to write a case that covers all possible responses.
18:21 oish joined
18:22 <bollu> dmwit: hmm
18:22 wraithm_ joined
18:22 <kuribas> What's a good debugging strategy? I find the ghci debugger rather painfull.
18:22 rlp10 joined
18:22 <bollu> dmwit: is there some way to emulate this in current haskell? short of writing a library
18:23 <dmwit> :t interact
18:23 <lambdabot> (String -> String) -> IO ()
18:23 <kuribas> Or use cpphs to conditionally produce debug output?
18:23 <bollu> interesting
18:23 <bollu> dmwit: that seems quite REPLy
18:23 oisdk joined
18:23 danza joined
18:23 <geekosaur> you could say it's an inside-out REPL
18:24 t0by joined
18:24 t0by joined
18:24 <geekosaur> unfortunately the inside-out-ness will confuse you very quickly in real programs
18:24 <geekosaur> you could also say it's the event loop from Hell
18:25 rixile joined
18:25 <bollu> oh wow, you are forced to be lazy and consume just the right amount
18:25 pleax joined
18:25 vektorweg1 joined
18:25 <bollu> people actually coded like this? o.O
18:25 <geekosaur> because you're working the wrong side of it; the "normal" event loop is the runtime processing it from the other side
18:25 <sdrodge> bollu: Very briefly, yes.
18:25 MarcelineVQ joined
18:25 <bollu> sdrodge: so, like, between monads and this, there was no other way to go?
18:25 <bollu> geekosaur: yeah
18:25 calincru joined
18:26 coltfred_ joined
18:26 <dmwit> "No other way to go"? This seems unlikely.
18:26 <sdrodge> bollu: Not sure. My only exposure to this is from SPJ paper/talks where he mentions it.
18:26 <geekosaur> iirc the decision came down to 3 things, but I can;t remember the third (the second was current monadic I/O)
18:27 <dmwit> But the current solution has a lot of attractive properties. The burden is on *you* to come up with an alternative with better properties. =P
18:27 <geekosaur> so at least one other alternative that was judged to be inferior
18:27 <dmwit> Not on us to prove that all other alternatives are "worse"!
18:27 <sdrodge> He refers to the [Response] -> [Request] lazy list model of I/O as the embarassing time before someone figured out monads would work.
18:27 <bollu> geekosaur: do you know where I can read about the 3rd choice?
18:27 <dmwit> http://r6.ca/blog/20110520T220201Z.html
18:27 <bollu> dmwit: yeah, I was just curious about the design soace
18:27 <bollu> space*
18:27 <geekosaur> not offhand but probably the hair shirt paper
18:28 <geekosaur> which is what I think sdrodge is referring to
18:28 <geekosaur> @google haskell hair shirt
18:28 <lambdabot> https://www.microsoft.com/en-us/research/publication/wearing-hair-shirt-retrospective-haskell-2003/
18:28 <dmwit> bollu: (That r6.ca blog post was an answer to your question to geekosaur, I think.)
18:28 rperry joined
18:28 jle` joined
18:28 jle` joined
18:29 Swizec joined
18:29 <dmwit> bollu: (I think his third alternative is called `Dialogue2` there.)
18:29 <sdrodge> geekosaur: Yeah. I think that's the paper I'm recalling.
18:29 <geekosaur> also there is no guarantee that there weren;t other possibilities; there just werent any other proposals at the time
18:29 <bollu> wow, the dialogue this is similar to free monads in some sense
18:29 <bollu> thing*
18:29 <dmwit> Yes, that is not an accident. =)
18:30 <bollu> dmwit: :)
18:30 <geekosaur> it's a moderately common pattern, and not limited to haskell documentation. see for example the Kerberos Dialogue in 4 Parts
18:30 <bollu> dmwit: I assumed the free algebra stuff was discovered later
18:30 <sdrodge> For another possible I/O model, see: http://www.idris-lang.org/documentation/effects/
18:30 <bollu> geekosaur: what is it about? just saw it
18:31 xcmw joined
18:31 <dmwit> geekosaur: https://web.mit.edu/kerberos/dialogue.html ?
18:31 <geekosaur> describing the reasoning behind the ((initial) implementation of the Kerberos authenticatin protocol
18:31 <geekosaur> dmwit, yes
18:32 jutaro joined
18:32 Swizec_ joined
18:33 zariuq joined
18:33 defaultnick_ joined
18:33 <sdrodge> btw, still looking for comments on how to improve this code: https://hastebin.com/jicequciqu.hs
18:33 <sdrodge> My solution feels very janky and hacked together, and I would appreciate the eyes of a more experienced haskeller.
18:34 <geekosaur> og feh, should have actually read the furst url, I was tryoing to keep up with too much and thought Dialogue refered to the prose part
18:34 jomg joined
18:34 <* geekosaur> is also failing to syynchronize with local housekeeping...
18:35 Robin_Jadoul joined
18:35 certainty joined
18:36 <dmwit> sdrodge: http://hackage.haskell.org/package/multiset-0.3.3/docs/Data-IntMultiSet.html
18:37 <sdrodge> dmwit: Unfortunately, this is for a hackerrank problem, and that library is not part of their environment.
18:37 defaultnick_ joined
18:37 Wuzzy joined
18:37 nick_h joined
18:38 angelos joined
18:38 <dmwit> Also, a very minor suggestion: `queries <- replicateM numQueries readLn`.
18:38 <dmwit> You should not need either type ascription.
18:39 <sdrodge> true, good point
18:39 shesek joined
18:40 tom7942 joined
18:40 wildlander joined
18:40 <dmwit> If raw speed matters, `even` and `odd` can be replaced with `Data.Bits` operations.
18:40 GreySunshine joined
18:40 ub joined
18:40 sdothum joined
18:40 <dmwit> (And computed once per call to `updateTrackers` instead of potentially four times.
18:40 <dmwit> )
18:41 pikhq joined
18:41 <dmwit> Possibly: `updateTrackers n ts = case (compare n median, odd s) of ...` would be more idiomatic.
18:41 <GreySunshine> Hello, does ghc have a risc V port?
18:41 wraithm_ joined
18:41 coot joined
18:42 f-a joined
18:42 augur joined
18:42 <dmwit> However, I haven't understood the algorithm well enough to be able to give deep advice; all of this is admittedly very superficial.
18:42 <dmwit> Apologies for that.
18:42 <sdrodge> dmwit: No problem. Still interesting suggestions.
18:42 <thoughtpolice> GreySunshine: People have worked on it, with the LLVM fork it's possible if you know what you're doing (people have gotten it working in RISC-V/QEMU). It's certainly not "officially supported" in any real sense while all the toolchains, etc are still being merged upstream and ironed out, however.
18:43 MP2E joined
18:43 <sdrodge> dmwit: The high level overview of what is going on is that you're fed a series of integers, if they are positive, you should add them to the current set and recompute the median of the set, if they are negative, you should roll back the state by the corresponding amount (where -1 means repeat the state that we were just at).
18:43 ertes joined
18:43 <f-a> I am reading ye olde yampa paper. There is a datatype (Identity list) which reads: data IL a = IL { ilNextKey :: Int, ilAssocs :: [(Int, a)] }. Does it have a name? (And most importantly, does it have a package? List doesn't seem the most efficient way to implement it)
18:44 <sdrodge> dmwit: So I'm just tracking the state after each query as an IntMedianTracker in a sequence.
18:44 shafox joined
18:44 <sdrodge> Which gives me O(log n) new state creation and O(log n) access to previous states.
18:44 <sdrodge> Which is good enough because you get at most 10^5 queries.
18:45 janos joined
18:45 <sdrodge> I'm mostly looking for suggestions about a better way to structure the code, since the structure feels a little disgusting, and possibly ways to improve the asymptotics without using ST or IO.
18:46 janos__ joined
18:46 edwinvdgraaf joined
18:46 <sdrodge> Maybe there's some unified data structure that didn't occur to me that does median tracking as well as persistence?
18:47 dustmote joined
18:48 Guest64317 joined
18:48 raynold joined
18:48 janos joined
18:49 <kadoban> sdrodge: Yay hackerrank haskell people xD Not enough haskellers on there, heh.
18:49 <sdrodge> kadoban: xD
18:50 janos joined
18:51 HarveyPwca joined
18:51 FullyFunctional joined
18:51 sobaken joined
18:52 zariuq joined
18:52 janos__ joined
18:53 Rodya_ joined
18:53 <dmwit> f-a: There is `IntMap`.
18:53 sid_fules joined
18:53 <kadoban> sdrodge: You can just use Data.Map.Map using either elemAt and size to check the median, or splitRoot in case elemAt isn't in the version they use, can't recall. The constants will be worse, but less code required.
18:54 kosorith joined
18:54 <f-a> dmwit: thanks. are the ints in intmap invariant with the respect to the changes (add/remove) to the map?
18:54 <kadoban> IntMap would also work for the same idea, except `size` in O(n) in IntMap
18:54 JeanCarloMachado joined
18:54 <kadoban> is O(n)*
18:55 pantsman_ joined
18:55 <sdrodge> Nice. Didn't know about that.
18:57 <dmwit> IntMap doesn't support elemAt. =(
18:58 <kadoban> Ya, IntMap isn't super useful for this. If you annotate it with the size, so you can check in O(1) time, then you can implement "elemAt" using splitRoot without too much trouble, but at that point I'm not sure it's worth it.
18:58 ner0x652 joined
18:58 mdtusz joined
18:58 Younder joined
18:58 <kadoban> Also splitRoot doesn't really guarantee wtf it does I guess, it's more of an internal function it seems, but ... in practice it'd be fine anyway.
18:58 <dmwit> splitRoot won't give you annotated subtrees.
18:58 <sdrodge> Still certainly gonna be cleaner than the juggling between two maps that I'm doing.
18:59 <kadoban> dmwit: Hmm ... good point.
18:59 oish joined
18:59 Tariskun joined
18:59 <dmwit> IntMap doesn't support elemAt for exactly the same reason size is O(n). You could fix both, at the cost of reduced efficiency and increased space usage for all other operations.
18:59 kubuntu_ joined
18:59 <dmwit> This was a conscious engineering decision made by the containers folks and unlikely to be reversed.
19:00 <sdrodge> kadoban: Wait, elemAt wouldn't work, would it?
19:00 <dmwit> Why not?
19:00 <sdrodge> Because it doesn't take into account the MultiSet structure.
19:00 <sdrodge> 1 1 1 5 10
19:01 <dmwit> Oops, even worse. =)
19:01 <kadoban> sdrodge: From Data.Map? Should. Oh did I miss part of it? Oh, to make it a multiset, just make every element unique. zip them with [0 ..] first?
19:02 ilja_kuklic joined
19:02 cris_ joined
19:02 <cris_> hello
19:03 defaultnick___ joined
19:03 <sdrodge> kadoban: That's starting to get just as ugly as the current solution, imo.
19:03 <kadoban> Ya, it's not terribly pretty. Anything to avoid having to create actual data structures though :)
19:04 <sdrodge> What's wrong with making data structures?
19:04 nnkd1 joined
19:05 <kadoban> Requires a lot of effort. If I can just reuse one that already exists, and if it wont' get TLE or whatever, I usually do that.
19:06 <johnw> TLE?
19:06 vimalloc_ left
19:06 gehmehgeh joined
19:06 <kadoban> time-limit-exceeded. They mentioned hackerrank.com earlier, it's a programming competition site.
19:07 <dmwit> sdrodge: Honestly, I think your current code is pretty nice.
19:08 mszczygiel joined
19:09 <sdrodge> dmwit: Okay. Perhaps my feeling of disgust is unwarranted. Thanks for giving it a look!
19:09 <dmwit> I would change your guards to `case (n <= median, odd s) of ...` just because then it's very clear we're covering all the cases (to the point that even the compiler can see it -- or warn you), but it's really just fine I think.
19:09 oish joined
19:09 <sdrodge> Yeah. I agree with you on that.
19:09 <sdrodge> Gonna have to use viewL to make it work, but that should be cleaner than what I did anyway.
19:10 <kadoban> dmwit: Nice, never though of doing that transformation of guards.
19:12 danthemyth joined
19:13 mizu_no_oto_work joined
19:13 pleax joined
19:13 fre2 joined
19:14 gehmehgeh joined
19:14 <dmwit> sdrodge: I'm not sure I see why any of the other code would have to change.
19:14 <dmwit> Where does `viewL` come in?
19:15 <sdrodge> dmwit: To pattern match on empty vs. non-empty sequences in that same function instead of just using an S.null guard.
19:15 <dmwit> Oh. I'm fine with that part of the guard if you are. =)
19:16 <dmwit> `| S.null ts = ... | otherwise = case ... of ...`
19:16 caumeslasal joined
19:16 TheEpsylon- joined
19:16 <dmwit> I think GHC even has something special in its pattern completeness checker for `otherwise`.
19:19 Jesin joined
19:19 sh0rug0ru joined
19:19 filipovsky joined
19:20 osa1 joined
19:20 osa1 joined
19:21 defaultnick___ joined
19:23 HarveyPwca joined
19:23 dfeuer joined
19:25 sigmundv joined
19:25 biglama joined
19:26 michaelt joined
19:27 <cris_> hi dmwit, you helped me yesterday, u are very action in IRC
19:27 <cris_> active
19:27 <sdrodge> dmwit: How about this? https://hastebin.com/sidagedire.hs
19:28 cyborg-one joined
19:30 defaultnick___ joined
19:30 Luke joined
19:31 michaelt joined
19:31 chlong joined
19:31 <sdrodge> To be honest, I would be shocked if the compiler isn't smart enough to convert the guard version into the case version (with the exception of the S.null vs the pattern match).
19:31 ystael joined
19:33 snowlemurian joined
19:36 wraithm_ joined
19:36 emmanuel_erc joined
19:36 deepfire joined
19:36 cdg joined
19:39 V3 joined
19:39 tomphp joined
19:40 janos joined
19:41 janos joined
19:43 kubuntu joined
19:44 paolino joined
19:45 <filipovsky> Hi everyone! I'm working on a podcast episode about UI APIs. Was hoping you could recommend approaches or people that are worth researching. UI is all about working around side-effects I figured Haskell community is good place to ask.
19:45 twanvl joined
19:45 Rodya_ joined
19:45 <filipovsky> A short version of the pitch:
19:45 <filipovsky> > DOM API, iOS UIViews, Android Views and Activities are ... well.. awful. I'm looking for ideas around how to write UI code that is composable, testable and flexible.
19:45 <lambdabot> <hint>:1:8: error: parse error on input ‘,’
19:46 <filipovsky> The slightly longer version: https://discuss.codepodcast.com/t/idea-pitch-weird-ui/32
19:47 sanitypassing joined
19:47 <filipovsky> Grapefruit looks interesting, but I could reach the author https://wiki.haskell.org/Grapefruit
19:47 <filipovsky> *could not
19:47 <ongy> we have reflex-dom (which I have no experience with) for browser-based things, brick for tui and no idea if anything for native gui
19:47 t7 joined
19:47 bjz joined
19:48 <mbeidler> react-flux is really nice for GHCJS
19:48 <f-a> does reflex work (well) with canvas?
19:48 <sternmull> there are bindings to wxWidgets and others. But i have no idea about their quality.
19:48 <mbeidler> You can use it with React Native and people have also built electron apps with it.
19:49 <mbeidler> https://hackage.haskell.org/package/react-flux
19:49 <filipovsky> is reflex/react-flux similar to react.js ideologically?
19:50 <filipovsky> seems so
19:51 defaultnick___ joined
19:51 <mbeidler> I'd say for react-flux yes. I haven't used reflex much, but I think it's more of a full-fledged FRP system.
19:52 Cale joined
19:52 max3 joined
19:53 <louispan> you might want to check out glazier-react that I'm currently working on
19:53 <jle`> filipovsky: it might be fruitful to ask in #reflex-frp, or also on the reddit :) not everyone relevant might be online on irc at the moment
19:53 <louispan> I think it's a simpler version of FRP. It's Elm-inspired - but IMHO better because in haskell we can use typeclasses
19:54 <louispan> And widgets are actually composable (you can make bigger widgets out of smaller ones) without changing any code in the smaller widgets.
19:54 deepfire joined
19:55 <filipovsky> <jle`>: got it, thanks
19:55 <louispan> Does anyone know if it's possible to run multiple template haskell splices in one go?
19:55 oisdk joined
19:56 <* geekosaur> is not sure what that even means
19:56 rixile joined
19:56 Rodya_ joined
19:56 wraithm_ joined
19:56 <louispan> makeClassyPrisms ''Action
19:56 <louispan> makeClassy ''Callbacks
19:56 <louispan> makeClassy ''Model
19:56 <louispan> Can I do o
19:56 CurryWurst joined
19:57 <louispan> $(makeClassy ''Action, makeClassy ''Callbacks, makeClassy ''Model) instead
19:57 <louispan> I'm just wondering because generating TH using GHCJS takes a bit of time, and I'm wondering if generating three at once will save time.
19:58 f-a left
19:58 zcourts joined
19:58 <geekosaur> probably not, since ghcjs is using a backend process so the overhead should only apply to the first splice
19:58 TxmszLou joined
19:59 orbifx joined
19:59 dustmote_ joined
19:59 andrei_chifa joined
19:59 <louispan> geekosaur: thanks for answering
20:00 <geekosaur> basically those kinds of splices *themselves* are expensive, and youre far from the only one to notice (whether using ghc or ghcjs)
20:00 <geekosaur> makeClassy is doing a lot of work behind the scenes
20:00 <cris_> hi all, i want to install "haste" into cabal sandbox , i first type $cabal sandbox init
20:00 <cris_> 1.0 create a folder , say ~/Downloads/sand 1.1 go to https://hackage.haskell.org/package/haste 1.2 download - haste-0.1.1.tar.gz to ~/Download 1.3 extracted to ~/Downloads/sand ; 1.4 go to ~/Downloads/sand/haste-0.1.1 2.0 $ cabal install --only-dependencies
20:01 sdothum joined
20:01 figitaki joined
20:01 <cris_> but after the last command: cabal install --only-dependencies, the following errors occur:
20:03 patbecich joined
20:03 Berra joined
20:03 <geekosaur> cris_, for starters I would 'cabal get haste', 'cd haste', 'cabal sandbox init'
20:03 arj joined
20:04 <geekosaur> (or whatever dir haste ends up in, which will likely be versioned)
20:05 <cris_> curl-1.3.8 failed during th ecnofigure step
20:05 prohobo joined
20:05 <cris_> configure step
20:05 JoshS joined
20:06 certainty joined
20:07 <cris_> thanks geekosaur
20:07 urdh joined
20:07 <geekosaur> that probably won;t help with the curl error, but it's a bit simpler/shorter setup
20:07 <geekosaur> as for curl, there should be a build log somewhere. also, what platform are you on?
20:08 <geekosaur> (often you need to install devel libraries)
20:10 <zcourts> Can someone tell me what's wrong with this: GHC error `a1` is a rigid type variable bound by the type signature for >>>
20:10 yogsototh joined
20:10 <zcourts> class X c where
20:10 <zcourts> (>>>) :: a -> b -> c
20:10 <zcourts> data Y a b = Y a b
20:10 <zcourts> instance X (Y a b) where
20:10 <zcourts> (>>>) = Y
20:10 <ski> `a' and `b' in the type signature of `(>>>)' is unrelated to `a' and `b' in `X (Y a b)'
20:10 mwsb joined
20:11 <ski> the type of the method `(>>>)', for `X c' is `forall a b. a -> b -> c'
20:11 wraithm_ joined
20:11 lak joined
20:11 augur joined
20:11 <ski> (considered as "just another variable", its type is `forall a b c. X c => a -> b -> c')
20:11 <cris_> hi geek , i am using Debian 8.7.1 with haskell-platform (ghc 7.6.3 ; cabal 1.20)
20:12 <ski> this means that an implementation of `(>>>)' *must* be able to take two inputs of *any* types `a' and `b' whatsoever, completely unrelated to the type of `c' (which was `Y a0 b0' in your case, after renaming those `a' and `b' to `a0' and `b0' to avoid confusion)
20:13 <ski> this in turn means that since an implementation of `(>>>)' can have no idea what the two types `a' and `b' of its arguments are, there is (by parametricity) *no* way it can inspect those arguments
20:13 <cris_> > geeko , i often use nix , but now i plan to create my own package to upload to Hackage, but i could only find cabal guide , so i need to learn cabal from scratch , does anyone know any practical guide for nix user to upload to Hackage?
20:13 <lambdabot> <hint>:1:7: error: parse error on input ‘,’
20:14 <ski> .. so you might as well have passed two arguments of type `()', or not having passed them at all
20:14 <ski> zcourts : so, at it stands, those two arguments of `(>>>)' are useless ..
20:14 pleax joined
20:15 <zcourts> ski: oh I see ;( - what's the approach to defining those two arguments so as to make them not useless
20:15 <ski> zcourts : .. now, perhaps if you could elaborate on what you're trying to do, we could suggest something more helpful of a positive kind (as opposed to the negative kind, knowing what doesn't work usefully, and why)
20:15 defaultnick joined
20:15 connrs joined
20:15 <ski> zcourts : hard to see what you're trying to do, or even why you're defining a new type class in the first place ..
20:16 <ski> zcourts : typically, one should only make a new type class in case one has at least two different instances of it in mind
20:16 <ski> (and even then one should consider whether one really needs a type class)
20:17 <ski> zcourts : perhaps you want functional dependencies, perhaps you want something completely different. please elaborate on what you want to do
20:17 <zcourts> I'm not implementing any real world code, I am reading about typeclasses again and writing quick snippets to refresh my memory, it's been a while since I;ve written any Haskell. My intention was just to define a type class that hadd 1 function for which I could create 2 instances that i'd then have do diff things and just print
20:18 <ski> which two instances ?
20:18 andrei_chifa joined
20:20 <zcourts> Hadn't gotten as far as to implement a second one because the first didn't work, but I had something as simple as addition in mind, so data Y and data Z's constr were just going to have 2 ints put in. Complete waste for a typeclass since one would do the same thing but it'd get me two types to start playing with as I worked through the book
20:21 <ski> perhaps you could try playing around with `class X c where (>>>) :: Int -> Int -> c' or `class X c where (>>>) :: c -> c -> c' ?
20:22 insitu joined
20:22 guampa joined
20:24 <zcourts> Yeah, I'm totally jumping the gun, I'm sure the book gets to this. I'll start with what you've suggested, get it to work and finish the chapter before doing anything else.
20:24 Igloo joined
20:24 insitu_ joined
20:24 mwilly joined
20:25 ozgura joined
20:25 <ski> one could also imagine `class X a b c where (>>>) :: a -> b -> c' (with or without FDs added), but that strikes me as being enough "amorphous" that probably it won't be very useful
20:26 carlomagno joined
20:27 sirmob joined
20:27 Levex joined
20:27 janos joined
20:28 uglyfigurine joined
20:28 AndreasK joined
20:29 EvanR_ joined
20:30 <zcourts> perhaps - I'll do a mini project to have solid/concrete types to implement. That should get rid of the superflous/"amorphous" types I'm trying to create
20:31 ramzifu joined
20:33 pleax joined
20:33 xcmw joined
20:33 athan joined
20:33 ilja_kuklic joined
20:34 yfeldblum joined
20:34 yogsototh joined
20:35 mofasa joined
20:35 petervaro joined
20:36 Tariskun joined
20:38 paolino joined
20:38 levex_ joined
20:38 Rodya_ joined
20:38 Destol joined
20:39 Cassiopaya joined
20:39 Luke joined
20:41 sdothum joined
20:43 takle joined
20:44 sirmob joined
20:45 MP2E joined
20:46 orbifx joined
20:46 stites joined
20:46 srbaker_ joined
20:46 tommd joined
20:47 bennofs joined
20:48 pleax joined
20:48 <okeuday_bak> does haskell at any point read from global state that is a constant related to the platform used, to determine how logic should function, but does so as a pure function, or is that impossible?
20:48 ask4olivia joined
20:49 owiecc joined
20:49 <geekosaur> okeuday_bak, it's something of a sore point among some. see https://downloads.haskell.org/~ghc/8.0.2/docs/html/libraries/base-
20:50 <geekosaur> (the argument being that on some level they really shouldn't be pure)
20:50 <okeuday_bak> geekosaur: so doesn't that mean it isn't clear whether or not that is a pure function, or is it just a question of how you define purity?
20:50 <geekosaur> however most programs use Cabal build configurations conditionalized by platform in the cabal file
20:50 <xa0> xni
20:51 <xa0> xnull:
20:51 <geekosaur> the latter
20:51 <xa0> xnil:
20:51 akhov joined
20:51 deepfire joined
20:51 <okeuday_bak> geekosaur: k, thanks
20:51 <geekosaur> there's folks who define it operationally, and those who want it to obey strict laws
20:51 <xa0> Xnuk:
20:51 <okeuday_bak> geekosaur: strict laws being laws that are consistent on all platforms, right?
20:52 <xa0> Xnuk: are you xnil
20:52 insitu joined
20:52 <geekosaur> strict laws meaning it obeys a mathematical notion of purity instead of a practical one
20:52 <okeuday_bak> geekosaur: k, makes sense
20:52 kubuntu joined
20:52 <geekosaur> (wherein the platform you compiled on is not going to change regardless of how/where you run the result)
20:53 <geekosaur> but that is also a warning, those things are resolved at compile time and if you run a program built on x86 on an x86_64, System.Info will tell you about the x86 it was built on and not the x86_64 you ran it on
20:54 <okeuday_bak> geekosaur: k
20:57 janos joined
20:59 markus1189 joined
21:00 nycs joined
21:00 MP2E joined
21:03 jessekempf joined
21:04 EvanR_ joined
21:05 doomlord joined
21:05 grayjoc joined
21:06 markus1189 joined
21:08 meoblast001 joined
21:09 oish joined
21:10 <jessekempf> How does one go about excluding certain modules or functions from an HPC test coverage report when using `stack test —coverage`?
21:10 <jessekempf> I've read https://github.com/commercialhaskell/stack/blob/master/doc/coverage.md and https://wiki.haskell.org/Haskell_program_coverage and it's not clear to me how to fit them together.
21:12 FullyFunctional left
21:13 castlelore joined
21:13 castlelore joined
21:13 sid_fules joined
21:13 Rodya_ joined
21:13 peterbecich joined
21:14 PennyNeko joined
21:15 mr_sm1th joined
21:16 louispan joined
21:19 autopawn joined
21:20 kelvey joined
21:21 augur joined
21:21 defaultnick___ joined
21:21 Luke joined
21:22 Einwq joined
21:23 ystael joined
21:23 nomotif joined
21:24 <autopawn> :q
21:24 sh0rug0ru joined
21:25 ewerty joined
21:25 wraithm joined
21:27 cur8or joined
21:28 jophish_ joined
21:30 defaultnick joined
21:31 rgr joined
21:31 freusque joined
21:31 Koterpillar joined
21:31 wraithm joined
21:33 ertes joined
21:36 zdenal joined
21:36 buglebud_ joined
21:39 orbifx joined
21:41 CurryWurst joined
21:41 _flow__ joined
21:41 albel727 joined
21:41 wtetzner joined
21:41 jutaro joined
21:43 simukis__ joined
21:47 ricardo82 joined
21:47 albel727 joined
21:47 _flow__ joined
21:48 anuxivm joined
21:49 the-gingerbread- joined
21:50 mzabani joined
21:50 buglebud_ joined
21:51 Thra11 joined
21:52 <mzabani> hi everyone! Can someone explain me why my Monad Transformer's implementation fails to compile with "The coverage condition fails in class ‘MonadReader’ for functional dependency: ‘m -> r’" when making it an instance of MonadReader such as: instance MonadReader r m => MonadReader r (TunnelT m) where?
21:52 hiratara joined
21:52 janos joined
21:52 TxmszLou joined
21:53 <c_wraith> mzabani, because the first type argument doesn't start with a concrete type constructor.
21:53 buglebud_ joined
21:54 <c_wraith> mzabani, that error is basically useless with MPTCs and fundeps
21:54 <c_wraith> mzabani, just turn on UndecidableInstances
21:54 <mzabani> but do I really have to turn on UndecidableInstances for this?
21:55 ajp joined
21:55 <mzabani> It feels kinda bad to do that
21:55 <c_wraith> why?
21:55 <c_wraith> UndecidableInstances is specifically to allow what you want to do.
21:55 <monochrom> mtl turns it on too. http://hackage.haskell.org/package/mtl-2.2.1/docs/src/Control-Monad-Reader-Class.html
21:55 <mzabani> Isn't UndecidableInstances basically saying that I'll guarantee correctness of my instances?
21:55 <c_wraith> no.
21:55 EvanR_ joined
21:56 <monochrom> Where did you get that idea from?
21:56 <mzabani> hmm I didn't know mtl also used it..
21:56 <c_wraith> it just says "don't worry about monotonicity, instance resolution will terminate"
21:56 janos__ joined
21:56 <jle`> undecidable instances has nothing to do with correctness of instances heh
21:56 <mzabani> oh, sorry about that, I'm pretty new to all this :P
21:57 <jle`> i wonder where the idea comes from
21:57 <jle`> maybe the name sounds scary?
21:57 <mzabani> haha it does a little bit
21:57 <c_wraith> well, it's unclear what the Undecidable part refers to.
21:57 <jle`> it's about as benign as TupleSections
21:57 <c_wraith> all it means is that instance resolution isn't guaranteed to terminate.
21:58 <mzabani> oh that is good to know!
21:58 <Xnuk> xa0: no i'm not
21:58 tommd joined
21:58 <jle`> Sections kinda sounds scary if you have trauma with discussion sections in university
21:58 janos joined
21:58 <ertes> "undecidable" ≠ "unsafe" =)
21:58 <jle`> TupleSections sounds like a bad lecture section about tuples, who would want to turn that on?
21:58 <ertes> "undecidable" = "(something) might not terminate"
21:58 <jle`> :)
21:59 <c_wraith> if something goes wrong with UndecidableInstances, the worst case is a compiler error.
21:59 <Koterpillar> with Undecidable, what happens if I put in instances A a => A b and A b => A a?
21:59 <c_wraith> that's not too bad of a worst case.
21:59 <Koterpillar> or just something loopy
21:59 <c_wraith> Koterpillar, they'll be rejected as overlapping.
21:59 <mzabani> I was really under a very wrong impression on this. Thanks for clearing it out!
21:59 janos__ joined
21:59 <monochrom> The compiler has a loop counter for this. "I give up after 5 iterations"
22:00 <jle`> psh wait until i submit my patch solving the halting problem
22:00 <monochrom> "and here is the flag you need if you want me to try 500 iterations"
22:00 <c_wraith> Koterpillar, allowing overlapping instances actually gets a little scary.
22:00 conal joined
22:00 <monochrom> The problem with "meaningful" names.
22:01 <Koterpillar> I thought I could give priorities to overlapping instances?
22:02 gcross joined
22:02 janos joined
22:03 kubuntu joined
22:04 janos__ joined
22:05 patbecich joined
22:06 janos___ joined
22:07 Guest50119 joined
22:07 `^_^v joined
22:08 janos___ joined
22:10 silver joined
22:11 darthdeus_ joined
22:11 le_frogb_ joined
22:12 jodor joined
22:13 le_fro___ joined
22:13 <Gurkenglas_> What's a better way to write fmap concat . sequenceA? (also y no more ircbrowse search)
22:14 <jle`> :t fmap concat . sequenceA
22:14 <lambdabot> (Traversable t, Applicative f) => t (f [a]) -> f [a]
22:15 Levex joined
22:15 JoshS joined
22:16 <monochrom> If you change concat to join...
22:16 le_frogballs joined
22:19 _flow__ joined
22:19 cur8or joined
22:19 albel727 joined
22:19 mekeor joined
22:20 gmaleha joined
22:20 xcmw joined
22:21 mekeor joined
22:21 zygentoma joined
22:23 ricardo82 joined
22:23 vektorweg11 joined
22:24 a3Dman joined
22:25 sigmundv_ joined
22:26 steeze joined
22:27 JeanCarloMachado joined
22:27 ajp joined
22:29 t_h joined
22:29 t_h joined
22:30 Wizek joined
22:30 Wizek_ joined
22:31 hiratara joined
22:32 moth joined
22:33 cur8or joined
22:35 gugah joined
22:35 bob3434 joined
22:37 yfeldblum joined
22:40 <centril> is there a lens, :t Lens' (Maybe a) a ?
22:40 <johnw> that's a Prism'
22:40 <centril> johnw: thinking of _Just ?
22:40 <johnw> yeah
22:41 louispan joined
22:41 <robertkennedy> :t findZero
22:41 <lambdabot> error: Variable not in scope: findZero
22:41 takuan joined
22:41 <centril> johnw: so... I have a lens: Lens' TcExpr (Maybe Type), and now I need a lens: Lens' TcExpr Type
22:41 <centril> johnw: is that doable?
22:42 <johnw> not as a lens, no
22:42 Levex joined
22:42 <johnw> what happens if the slot has a Nothing?
22:42 <centril> johnw: just skip it, hmm...
22:43 <centril> johnw: the best I can get is: :: Applicative f => (Type -> f Type) -> TcExpr -> f TcExpr
22:43 <johnw> a Traversal, Fold or Prism can "just skip", but a Lens cannot
22:43 wraithm joined
22:43 jutaro joined
22:43 minn joined
22:43 <centril> which I guess fits into all lens functions since it's a stronger guaranteed than Functor f => ...
22:43 <centril> oh wait... no
22:44 <centril> the lens functions pick the functors, damn
22:44 <ski> the other way around, yes
22:44 Noldorin joined
22:44 oisdk joined
22:45 skeuomorf joined
22:45 wizardwizard joined
22:46 <centril> johnw, ski so... what does :t Applicative f => (b -> f b) -> a -> f a translate in the lens library if anything ?
22:46 <wizardwizard> so what work, if any, has been done on programming languages targeting heterogeneous computing platforms
22:46 <centril> translate to *
22:46 <johnw> Traversal
22:46 <wizardwizard> for example, i might have a computer with a single core CPU as a compilation target
22:46 ronnik joined
22:46 <wizardwizard> while another machine might be a quad core CPU with an FPGA attached
22:46 <wizardwizard> and a third might be a dual core CPU with GPU
22:47 <* ski> . o O ( `forall f. Applicative f => (b -> f b) -> a -> f a' )
22:47 <wizardwizard> and i might want to compile my program for any of the three platforms and get the best performance
22:47 <johnw> Traversal' :)
22:47 <wizardwizard> i might also need to provide some kind of formal description of my target platform to inform the compiler,...
22:48 <centril> wizardwizard: is the platform specified at compile time?
22:48 <centril> i infer that it is
22:48 <wizardwizard> ideally my code would know nothing about what platform it is being compiled to
22:48 <wizardwizard> but i could have separate code which provides as much detail as you want about the platform
22:48 <centril> right, but the compiler does ?
22:48 <wizardwizard> cache sizes, etc
22:49 <peddie> wizardwizard: have you looked at OpenCL? also, LLVM can generate code for different platforms (e.g. NVIDIA GPUs or intel CPUs) from a subset of its IR
22:49 <wizardwizard> the compiler would receive (1) my program and (2) the platform desciption
22:49 <centril> then I'd say LLVM
22:49 <centril> this is exactly what LLVM does...
22:49 <wizardwizard> LLVM opportunistically makes use of the GPU?
22:50 <centril> wizardwizard: well... that is a matter of adding optimization passes for that into LLVM, but in principle there should be nothing stopping it
22:50 <wizardwizard> i think openCL produces code for single targets
22:50 <centril> LLVM already does auto-vectorization, etc.
22:50 trism joined
22:50 t0by joined
22:50 t0by joined
22:51 <centril> the problem with GPUs is that they are very free to change from one iteration to another, and the abstraction-layers are not really meant for general purpose computation, until recently at least
22:51 JeanCarloMachado joined
22:51 <wizardwizard> right
22:51 <wizardwizard> and i can't keep up with heterogeneous architectures
22:51 <wizardwizard> it's just not feasible
22:51 <wizardwizard> i want to throw my code at a compiler and have it actually figure out what to do
22:52 <centril> I guess LLVM could compile to openCL / CUDA, etc... ?
22:52 ilja_kuklic joined
22:54 le_frogballs joined
22:57 <dedgrant> wizardwizard, centril, reminds me of this PASC project: http://www.pasc-ch.org/projects/projects/heterogeneous-compiler-platform/ (but I have no other info)
22:57 mdtusz joined
22:57 <peddie> centril: http://llvm.org/docs/NVPTXUsage.html
22:57 <wizardwizard> given that intel is going to start shipping CPUs with integrated FPGAs
22:58 <wizardwizard> it would be nice if my code simply automatically made use of whatever compute resource was available
22:59 ChaiTRex joined
23:01 dfeuer joined
23:02 orbifx joined
23:02 weatherforecaste joined
23:02 isenmann joined
23:03 tomphp joined
23:04 <centril> wizardwizard: yes, wouldn't it be nice if your code just magically ran on the GPU ;)
23:04 <wizardwizard> well yeah, that's the point
23:04 <centril> unfortunately, someone has to do the work ^^
23:04 ludat joined
23:04 <wizardwizard> it can't be that hard to pick out vector operations
23:05 <centril> well... doing vector opt in CPU is easier because the cost of moving data is less
23:05 <wizardwizard> right but in addition to a descrption of the system
23:05 <centril> but if you are moving stuff via PCI-E, then the compiler has to consider the cost of moving data to GPU first
23:05 <wizardwizard> the compiler could run various benchmarks testing latency, bandwidth, etc
23:05 alexknvl joined
23:05 <wizardwizard> and actually reason about the code
23:06 <wizardwizard> and even compile it, test perf, tweak, and so on
23:06 <centril> wizardwizard: yes, it is possible, but someone has to write that code that does it
23:06 <centril> Im guessing it will be done eventually
23:06 <wizardwizard> it seems like people think that compilers have to get it right on the first try
23:06 <wizardwizard> without any empiricism
23:06 <centril> once GPU general purpose languages and assembly stabilize
23:06 defaultnick joined
23:07 cschneid_ joined
23:07 weatherforecaste joined
23:07 <centril> you cant write optimizations for a target that is moving too fast
23:08 <centril> wizardwizard: another thing on my wishlist: rewrite LLVM in Rust
23:08 <wizardwizard> heh why?
23:08 <wizardwizard> finding bugs?
23:08 <centril> Cause C++ be unsafe
23:09 <wizardwizard> because you think LLVM has defects?
23:09 <wizardwizard> a minisat rewrite in rust found at least one serious bug
23:09 <centril> anything sizeable written in C++ is bound to have defects somewhere
23:09 <centril> and I'd very much not like bugs in a compiler...
23:10 <centril> I'd say bug free compilers are even more important than bugfree kernels
23:10 <* mniip> . o O ( a compiler in coq )
23:10 <centril> mniip: why not Agda? or Idris?
23:11 <zv> wizardwizard: even large SAT solvers have huge bugs, SMT solvers doubly so.
23:11 <wizardwizard> haha
23:11 <wizardwizard> so why use them?
23:11 <wizardwizard> i guess,... run on two independent implementations...?
23:11 <mniip> they are crazy fust
23:11 <mniip> fast*
23:11 <zv> sortof
23:12 castlelore joined
23:12 castlelore joined
23:12 jan_path joined
23:12 <zv> Crazy fast becomes crazy slow when you want to satisfy literals over a theory of, say, Integers.
23:12 <mniip> and by fast I mean in real world cases they provide fairly subexponential complexity on large inputs
23:12 <mniip> sure
23:13 <* centril> sprinkles some dependent types on the problem and, poof, all my troubles seem so far away...
23:13 <zv> To verify 32-bit integer addition, that's equivalent to literally thousands (maybe millions) of CNFs
23:13 <mniip> once we have efficient SAT over bit-encoded integers we'd have defeated modern cryptographic hash functions
23:13 <zv> Sorry, to verify a *SINGLE* 32-bit addition
23:14 <mniip> zv, don't SAT solvers take expression graphs?
23:14 <centril> zv: wth... using SAT for additions ?
23:14 <mniip> integer addition in a graph is fairly compact
23:14 <mniip> linear size in fact
23:14 <zv> mniip: SMT solvers encode higher order logics into a sequence of SAT problems
23:14 buglebud_ joined
23:14 <zv> So, for example, for the "theory of" u8 addition
23:14 <mniip> right
23:14 <centril> oh, right
23:14 <peddie> wizardwizard: isn't the thing with SAT (well, NP) that you can verify efficiently, just not solve efficiently? so you don't need two implementations of the solver :)
23:14 <mniip> do SAT solves benefit from CNF?
23:15 <zv> You might have (assert (= (+ 2 4) 6))
23:15 defaultnick joined
23:15 connrs joined
23:15 dan_f joined
23:15 <wizardwizard> you can verify, but what does the verification?
23:15 <mniip> otherwise, is there a reason a SAT solver can't benefit from a graph encoding of the input as opposed to a CNF
23:15 <zv> That SMTLIB2 code is going to be converted into 700 variables and 1060 clauses
23:15 <solrize> mniip, compcert.inria.fr
23:15 <monochrom> There is no real loss if an SMT solver is wrong. No real loss compared to the days before there were SMT solvers.
23:15 <centril> https://en.wikipedia.org/wiki/Conjunctive_normal_form#Computational_complexity
23:16 <wizardwizard> computing is a steaming pile of dung
23:16 <wizardwizard> and is impossible to do correctly
23:16 <wizardwizard> i think that's the lesson
23:16 markus1189 joined
23:16 <monochrom> That is, before, you assumed (wrongly) that your program was perfect.
23:16 <centril> wizardwizard: that is a really sad lesson i hope not to draw
23:16 Fairy joined
23:17 <centril> some languages allow computing to be made more correctly
23:18 deliciou5cake joined
23:18 <centril> (Idris/Agda/Haskell/Rust, ...)
23:18 <monochrom> With a buggy SMT solver, sometimes it correctly points out a bug, so you gain. Sometimes it incorrectly overlooks a bug, no loss compared to before. Sometimes it incorrectly claims you have a bug, but you will investigate, right? You will find that the bug is not with your program, no loss.
23:18 <mniip> centril, yeah but CNF is exponential of the input size
23:18 deliciou5cake left
23:18 <mniip> so no wonder it's NP-hard timewise
23:19 rgr joined
23:19 <centril> monochrom: if your compiler claims that correct programs are incorrect then we have a problem...
23:20 <zv> mniip: it's possible to immediately eliminate many unprofitable avenues of exploration (in the universe of possible satisfactions of a set of variables), so not nessasarily
23:20 <centril> mniip: what about the k-SAT thingy ?
23:20 <zv> kSAT is even more complex
23:21 <centril> 2-SAT then
23:21 <zv> centril: which can be *even* harder to solve than 3sat
23:22 <centril> zv: wiki says "known to have solutions in polynomial time..."
23:22 <zv> Remember, every binary clause (2sat) is equivalent to two 3sat clauses
23:22 <centril> oh, right
23:22 <zv> centril: The art of computer programming Volume 4 Fascicle 6 discusses this problem
23:23 <zv> but yes, in general you are absolutely correct
23:23 <zv> anwyay, I hijack the conversation every time the topic of SAT solving comes up
23:23 <zv> It's such a fantastic vehicle of research for everything from automated bug hunting to program verification
23:24 <centril> zv: yes, ..., how did we go from Code => GPU to SAT?
23:25 <wizardwizard> (the original question btw wasn't code => gpu but code => gpu + cpu + fpga + anything else avail)
23:25 <centril> zv: speaking of program verification... I'm currently writing my bachelors thesis (with 5 others) about automated assessment of programming exercises, where the exercises are written in Java (sadly...)
23:25 <wizardwizard> maybe even code => networked devices
23:25 defaultnick joined
23:25 <wizardwizard> hehe
23:25 <centril> wizardwizard: I claim Code => GPU is a subproblem of your problem
23:26 <wizardwizard> yeah :)
23:26 nick_h joined
23:26 <koala_man> centril: neat. what does it handle that testing doesn't?
23:26 <centril> reading the JLS is not much fun... at every corner there is another special case
23:26 <zv> centril: it's definitely doable at this point
23:27 <zv> That is to say, "Making abstract claims about machine code", or perhaps even Java
23:27 <centril> koala_man: we use normalization + strategies to verify that 2 programs are the same structurally, instead of running the code
23:27 eschnett joined
23:28 tromp joined
23:28 <centril> well... since normalization + strategies is undecidable, we fall back on property based testing
23:29 Levex joined
23:29 <centril> zv: replicating this in LLVM would be interesting
23:29 <dedgrant> wizardwizard: If you rephrase your problem as, "what if we had a solution to the Optimization Problem?" then we could say that SMT solvers have resulted in some powerful tools for exploring the problem.
23:29 <centril> then you can prove that 2 programs from 2 diff languages are the same
23:29 <zv> centril: have you heard of the tool Klee?
23:30 <koala_man> centril: so an exercise would be e.g. "quicksort a list" and not a broader "sort a list"?
23:30 louispan joined
23:30 <zv> It operates on LLVM IR, can 'symbolically execute' a program without every actually running it
23:30 <centril> koala_man: right, but more introductory programming exercises
23:30 <centril> zv: ooh, that is cool
23:30 <zv> So you could determine if it fulfills certain non-trivial criteria (inb4 rices theorem).
23:31 <zv> I've used it to find real-deal exploitable heap and buffer overflows in major language runtimes with a minimum of effort, I highly recommend it
23:31 <koala_man> centril: seems very useful if you can add a set of known good solutions and known bad solutions, and the system will classify ~95% of submissions automatically
23:32 <centril> koala_man: yes, that is what we intend to do
23:32 <centril> we call them "student-" and "model-solutions"
23:32 biglama joined
23:34 JeanCarloMachado joined
23:35 <centril> koala_man: relevant reading: http://dspace.ou.nl/bitstream/1820/5388/1/INF_20140617_Keuning.pdf
23:35 <wizardwizard> bbl
23:37 mdtusz joined
23:38 jmcarthur joined
23:40 NeverDie joined
23:40 xcmw joined
23:40 <srk> looking for some feedback if anyone wants to play with lan p2p networking https://git.48.io/zre
23:41 halogenandtoast joined
23:41 nemorichard joined
23:41 <srk> want to push it to hackage soon
23:42 alx741_ joined
23:43 shookees joined
23:43 shookees joined
23:45 clinton joined
23:47 Tochty joined
23:48 Destol joined
23:51 defaultnick___ joined
23:51 jkla joined
23:51 jkla left
23:51 Fairy joined
23:51 Rodya_ joined
23:54 pleax joined
23:55 Tochty_ joined
23:58 oisdk_ joined
23:58 cmdd joined
23:58 carlyle joined
23:58 vimto joined
23:58 cur8or joined