<    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:01 <bitemyapp> m and n make nice number variables
00:01 ilja_kuklic joined
00:03 jrajav joined
00:03 peterbecich joined
00:06 cschneid_ joined
00:08 fhoffmeyer joined
00:10 ego joined
00:21 mounty joined
00:33 carlomagno joined
00:39 hphuoc25 joined
00:49 dni- joined
00:50 cschneid_ joined
00:55 aarvar joined
00:57 NoCreativity joined
01:08 Pupnik joined
01:09 fhoffmeyer joined
01:10 louispan joined
01:12 NoCreativity joined
01:13 <litwol> “Functional languages excel at wholemeal programming, a term coined by Geraint Jones. Wholemeal programming means to think big: work with an entire list, rather than a sequence of elements; develop a solution space, rather than an individual solution; imagine a graph, rather than a single path. The wholemeal approach often offers new insights or provides new perspectives on a given problem. It
01:13 <litwol> is nicely complemented by the idea of projective programming: first solve a more general problem, then extract the interesting bits and pieces by transforming the general program into more specialised ones.”
01:13 <litwol> OOPS
01:13 <litwol> Gosh i am so sorry.
01:13 <litwol> I meant to paste this into my private room, but i forgot to switch.
01:13 <MarcelineVQ> :>
01:13 <litwol> Above quote is from http://www.seas.upenn.edu/~cis194/spring13/lectures/01-intro.html by the way
01:21 jsthomas joined
01:28 <qu1j0t3> litwol: Actually that seems very appropriate
01:28 <qu1j0t3> litwol: I can use this right now!
01:34 twopoint718 joined
01:40 hphuoc25 joined
01:55 emmanuel_erc joined
02:00 harfangk joined
02:00 \Mike joined
02:01 conal joined
02:02 louispan joined
02:04 Youmu joined
02:06 conal joined
02:11 fhoffmeyer joined
02:12 <mounty> My documentation command is cabal haddock --executables --builddir=../site/documentation
02:13 <mounty> Can I put something in my project.cabal file to simplify that? With make, you'd have a pseudo-target and just'make doc'
02:14 <kadoban> Nothing says you can't have a Makefile, or shell aliases or anything
02:15 <mounty> Of course I could do any of those things but it would be nice to have it all in one place.
02:16 <kadoban> Right. I don't know of a way using just cabal-install.
02:16 <mounty> What about stack ?
02:16 <mounty> I suppose not because stack just uses the .cabal file -- it doesn't extend it or augment it in any way, AIUI.
02:16 <mounty> s/.cabal/project.cabal/
02:17 <kadoban> It does not add any capabilities to the .cabal file. I don't know of any way it could do that either. Maybe there's something in the stack.yaml you could add? I'm not positive either way honestly.
02:19 <MarcelineVQ> mmm yeah https://docs.haskellstack.org/en/stable/yaml_configuration/#build
02:20 <kadoban> Ah nice, haddock-arguments sounds very relevant
02:20 <mounty> OK thanks MarcelineVQ.
02:21 <MarcelineVQ> I'm not sure if those options apply from your project's .yaml or need to be in the global config though, you'll have to experiment
02:22 <kadoban> I'd think you could specify that type of thing in the local stack.yaml, because in one of the later parts it's saying that some of those aren't advisable to add to global.
02:22 <kadoban> So there wouldn't really be another place they're appropriate
02:23 <MarcelineVQ> well, there's two 'global' configs, there's a truly global config in /etc/stack and a user config in .stack
02:23 <MarcelineVQ> hopefully these options also apply per-project though
02:25 <kadoban> "The project file itself may also contain non-project specific options" <--- sounds like it
02:25 <MarcelineVQ> nice
02:25 <kadoban> Not that stack docs are always 100% definitive, but I'd also expect it to regardless
02:26 <mounty> Yes, I'm having difficulty making it work according to the documentation. This matter of reliability and accuracy in Haskell documentation is a major PITA IMO.
02:27 <mounty> If you can't keep it accurate, then pull it off the web or hand it over to someone who cares.
02:27 <MarcelineVQ> *Stack documentation I agree :>
02:27 <kadoban> Well, haskell docs in general are pretty reliable. Stack is just a fairly young project and changes quickly.
02:28 <mounty> I was thinking particularly of the Haskell wiki. https://github.com/dag/all-about-monads/issues
02:28 <mounty> has simple typos that have remained unfixed for months. DAG, if you're reading this either fix them or hand over to someone who gives a stuff.
02:29 <mounty> So my stack.yaml file has:
02:29 <mounty> build:
02:30 <mounty> # NOTE: global usage of haddock can cause build failures when documentation is
02:30 <mounty> # incorrectly formatted. This could also affect scripts which use stack.
02:30 <mounty> haddock: true
02:30 <mounty> haddock-arguments:
02:30 <mounty> haddock-args: ["--executables" "--builddir=../site/documentation"]
02:30 <mounty> The command 'stack haddock' fails with:
02:30 <mounty> Could not parse '/root/JackRose/source/stack.yaml':
02:30 <mounty> YAML parse exception at line 72, column 35,
02:30 <kadoban> That's probably not valid YAML syntax, I'd use the example it lists below that
02:30 <mounty> Line 72 is the haddock-arguments: line (assuming starting at line 1)
02:31 <kadoban> haddock-args: <newline> - "--stuff" <newline> - "--other-stuff" with the - lines indented and lined up.
02:31 <kadoban> YAML is weird, I pretty much guess at the syntax. I should probably learn it sometime.
02:32 <kadoban> Maybe it just needs a comma in your attempt? That could work
02:32 <mounty> Thanks kadoban: comma fixed it.
02:32 <kadoban> Cool
02:34 <mounty> Now my problem is that stack runs on CentOS and 'stack build --haddock' and 'stack haddock' don't do anything. They just return to the command prompt instantly.
02:34 <mounty> The cabal haddock command I was running was on Gentoo Linux.
02:35 <mounty> However, stack won't run on Gentoo, yet.
02:35 <kadoban> Try with -v, see if you can tell what it's doing?
02:35 <kadoban> stack doesn't work at all on gentoo?
02:36 andrei_chifa joined
02:36 <mounty> $ ./dist/dist-sandbox-6732a773/build/stack/stack build --install-ghc
02:36 <mounty> Unable to find installation URLs for OS key: linux32-ncurses6
02:37 <kadoban> I see
02:37 <mounty> I downloaded stack and bootstrapped it with cabal. But as above, it won't rebuild itself.
02:37 <mounty> I did ask on #haskell-stack but no response.
02:37 <kadoban> If you have the correct GHC on path, you can try --system-ghc perhaps
02:38 <kadoban> But as soon as you need a different version of GHC for a different resolver, it'll be annoying.
02:38 dni- joined
02:38 <mounty> That's exactly what I do need because Gentoo has gone 7.10.3 -> 8.0.2 since I bootstrapped so I'll have to remember how I bootstrapped and do it again.
02:41 hphuoc25 joined
02:42 hphuoc25 joined
02:43 <MarcelineVQ> which problem is being troubleshooted atm
02:44 <mounty> runhaskell Setup.hs configure encounters multiple missing dependencies.
02:44 <mounty> FFS I just want to get this working and it's a tar-baby.
02:45 <MarcelineVQ> get what working
02:45 <mounty> build stack on Gentoo with cabal
02:45 <kadoban> runhaskell Setup.hs ... can't say I've ever done that
02:45 <mounty> I'm following https://www.haskell.org/cabal/release/old/users-guide-0.1/x478.html
02:46 <mounty> Ok, that says old but it's the same at https://downloads.haskell.org/~ghc/7.0.1/docs/html/Cabal/builders.html
02:46 twopoint718 joined
02:46 <kadoban> 7.0.1 is also ancient
02:46 <kadoban> Setup.hs I think was what people used before cabal-install, I only know it as a relic that seems to annoy the shit out of anyone I see attempting to do anything with it.
02:47 <MarcelineVQ> Setup,hs is still relevant, but you don't run it directly
02:47 <MarcelineVQ> what source for stack are you using?
02:47 <* mounty> bangs head on wall.
02:47 <mounty> Is this Haskell or is it PHP FFS.
02:47 <kadoban> Well ... you are using docs from GHC 7.0.1 and ones that specifically say "old"
02:47 <kadoban> And 0.1 ...
02:48 louispan joined
02:48 <mounty> I'm trying to drill down beyond https://downloads.haskell.org/~ghc/8.0.2/docs/html/users_guide/index.html
02:49 <kadoban> I believe stack is meant to be built with GHC ... 7.10.x I'd have to check the resolver though
02:49 <kadoban> I don't know if you even can build it with GHC 8.0.2 yet
02:49 <mounty> Nothing to lose. cabal sandbox init.
02:49 <mounty> Sofarsogood.
02:50 <MarcelineVQ> what source for stack are you using?
02:50 <kadoban> Maybe you can, it looks like it has a stack-8.0.yaml in the repo now
02:50 brh joined
02:51 <mounty> Right, try again. git pull -v; rm -r cabal.sandbox.config .cabal-sandbox; cabal sandbox init
02:52 <MarcelineVQ> idk how gentoo works but there is a portage overlay available for stack if what you're doing doesn't work https://gpo.zugaina.org/dev-haskell/stack
02:55 <mounty> Overlays: too hard basket. cabal install appears to be downloading dependencies and doing something. It'll need some time though.
02:59 <litwol> did some one say gentoo?
03:00 <litwol> just today (being at day 0 with haskell.. first time ever) i was going from https://github.com/bitemyapp/learnhaskell
03:00 <litwol> Which recommended running `curl -sSL https://get.haskellstack.org/ | sh`
03:00 <litwol> Worked like charm /on gentoo/
03:01 <kadoban> Nice
03:01 <MarcelineVQ> runing shell commands from a remote website too scary for me
03:01 <litwol> I ran it inside LXC
03:01 <litwol> but.. agreed.
03:02 <kadoban> MarcelineVQ: Running binaries is better?
03:02 <litwol> There are plenty free virtual imachine images that you can run with virtualbox or whatever. plenty ways to keep yourself "safe"
03:03 <MarcelineVQ> kadoban: it's not a safe world I agree, at least binaries tend to also come with a hash to compare to :>
03:03 <kadoban> MarcelineVQ: A hash ... on the same website typically.
03:03 <litwol> mmm yummy plain text :-D http://get.haskellstack.org/
03:04 <MarcelineVQ> :> it's an extra step at least
03:04 <kadoban> MarcelineVQ: So someone wants to own you, but they're too lazy to run 'sha1sum pwn.exe' once?
03:04 <kadoban> I ... don't think you've thought this through.
03:05 <MarcelineVQ> I'm not sure where the conversation's headed, all I'm claiming is that one check is more than no check
03:05 <kadoban> All I'm claiming is that one extra useless hurdle does not increase security in any way. If they add an icon that says "this is totally not a virus, trust us" is that an extra check too?
03:06 <kadoban> That's essentially all a sha1sum on the same page gives you.
03:07 <MarcelineVQ> what it gives you is two seperate things that need to be changed by an attacker, and up to twice the chance someone notices something is up
03:07 <MarcelineVQ> mounty, command-chain that built for me: cabal sandbox init && cabal update && cabal install --dependencies-only --allow-newer && cabal configure && cabal build
03:08 <mounty> MarcelineVQ: cabal configure is still running for me here thanks.
03:08 <mounty> Sorry not cabal configure but cabal install
03:08 <kadoban> MarcelineVQ: If someone can change what you're getting served from a webpage, how is changing two words any harder than one?
03:11 <MarcelineVQ> it's not harder, it's more noticeable. what I had in mind was changing the binary where it's kept rather than where you're being directed to which is what I meant by two seperate things but it would make more sense for someone to just change the link :>
03:12 fhoffmeyer joined
03:12 <kadoban> Yes
03:16 <tmciver> Hey folks. I'm getting a weird error when running `stack ghci`: "/tmp/ghci25976/cabal_macros.h:683:0: error: warning: "CURRENT_COMPONENT_ID" redefined". This issue talks about it: https://github.com/commercialhaskell/stack/issues/2263, but I'm pretty sure my cabal version is at least 1.8. Any ideas?
03:17 <MarcelineVQ> what's your stack version?
03:18 <tmciver> $ stack --version: Version 1.0.5, Git revision c2ac54ab218d5817b5c0fe804f98babbdcaaedf2 x86_64
03:18 <MarcelineVQ> sounds like you need a new stack version
03:18 <kadoban> 1.0.5 is pretty ancient
03:18 <kadoban> 1.3.2 is newest release, and 1.4.1 is newest dev I think
03:18 <tmciver> MarcelineVQ: OK, I'll update it then. Thanks.
03:19 <MarcelineVQ> this fix is post 1.1.2 you'll notice from the page you linked, so you'll want something newer based on that alone
03:19 <tmciver> I upgraded my OS recently and am still dealing with the fallout. :|
03:20 <tmciver> MarcelineVQ: OK, I thought that issue was saying it was a cabal problem, but I'll update stack in any case. :)
03:21 <kadoban> It sounded like a mix to me, stack not being able to deal with a cabal-install version past some version. Though I didn't read too close.
03:21 <kadoban> (old stack that is)
03:22 andrei_chifa joined
03:22 peterbecich joined
03:30 permagreen joined
03:41 howdoi joined
03:43 <howdoi> g
03:46 peterbecich joined
03:49 takle joined
03:56 exferenceBot joined
03:57 takle joined
03:57 twopoint718 joined
04:00 hexagoxel joined
04:04 takle joined
04:13 Big_G joined
04:13 fhoffmeyer joined
04:27 dni- joined
04:31 Xlaech joined
04:33 hexagoxel joined
04:33 i-amd3 joined
04:37 shayan_ joined
04:56 peterbecich joined
04:57 hphuoc25 joined
05:03 takle joined
05:08 twopoint718 joined
05:11 takle joined
05:15 fhoffmeyer joined
05:26 takle joined
05:40 takle joined
05:42 kritzcreek_ joined
05:44 peterbecich joined
05:48 takle joined
05:55 lak joined
06:03 takle joined
06:10 takle joined
06:16 dni- joined
06:16 fhoffmeyer joined
06:19 twopoint718 joined
06:28 takle joined
06:30 aniketd joined
06:34 diamat joined
06:39 shayan_ joined
06:40 hphuoc25 joined
06:41 hphuoc25 joined
06:44 dni- joined
06:46 takle joined
06:52 jle` joined
06:56 takle joined
06:58 jle` joined
06:59 jle` joined
07:00 myrkraverk joined
07:03 takle joined
07:13 takle joined
07:14 hdeshev joined
07:14 hexagoxel joined
07:17 fhoffmeyer joined
07:20 takle joined
07:27 takle joined
07:31 twopoint718 joined
07:32 ali_bush joined
07:32 ali_bush joined
07:43 owiecc joined
07:58 thc202 joined
08:03 takle joined
08:13 takle joined
08:18 fhoffmeyer joined
08:23 sullyj3 joined
08:26 <sullyj3> Does anyone know of any up to date State Monad tutorials?
08:27 <sullyj3> I've been googling for ages and all the ones I've found reference a constructor "State" which no longer exists, and seems to have been replaced with a "state" method.
08:29 takle joined
08:33 <jle`> sullyj3: those tutorials should be ok more or less for understanding
08:33 <jle`> the onyl difference now is that the 'State' constructor is now abstract
08:33 <jle`> and is 'state' instead
08:34 <jle`> instead of State :: (s -> (a, s)) -> State s a
08:34 <jle`> it's exposed as state :: (s -> (a, s)) -> State s a, instead
08:35 takle joined
08:36 <sullyj3> jle`: Ok cool, cheers.
08:37 aarvar joined
08:38 <jle`> the only thing you "cant" do is pattern match on State
08:38 <jle`> although you can still use a fake "record accessor"
08:38 <jle`> runState :: State s a -> (s -> (a, s))
08:39 <jle`> (which should be identical to the traditional runState accessor)
08:40 xmonader joined
08:41 takle joined
08:42 twopoint718 joined
08:50 louispan joined
08:51 nil_ joined
08:52 grayjoc joined
08:57 takle joined
09:04 atz__ joined
09:17 grdryn joined
09:17 takle joined
09:20 fhoffmeyer joined
09:21 jle` joined
09:24 andrei_chifa joined
09:25 rlpowell joined
09:26 justicefries joined
09:28 killtheliterate joined
09:29 Tene joined
09:29 Tene joined
09:31 takle joined
09:32 eacameron joined
09:35 takle_ joined
09:36 NoCreativity joined
09:41 permagreen joined
09:44 jle` joined
09:53 exferenceBot joined
09:54 twopoint718 joined
10:00 Denth joined
10:07 hphuoc25 joined
10:09 jmorris joined
10:11 tsmish joined
10:14 jle` joined
10:18 takle joined
10:21 fhoffmeyer joined
10:25 hphuoc25 joined
10:25 zero_byte joined
10:28 merijn joined
10:28 Gurkenglas_ joined
10:29 qu1j0t3 joined
10:31 grayjoc joined
10:32 hphuoc25 joined
10:32 louispan joined
10:35 takle joined
10:38 grdryn joined
10:51 pie_ joined
10:55 AndreasK joined
11:05 twopoint718 joined
11:06 skapazzo joined
11:07 owiecc joined
11:07 shayan__ joined
11:08 cschneid_ joined
11:22 fhoffmeyer joined
11:24 kmelva joined
11:31 <Akii> I wonder if I could somehow come up with a function that takes an Z, Y or W and returns an A (http://lpaste.net/353338)
11:31 <Akii> certainly missing type-foo here
11:32 <Akii> obviously I'd like to avoid creating a sum type of Z, Y and W
11:32 <Akii> and work more torwards something like Exception handling
11:32 <Akii> but type-safe
11:33 <Akii> Servant does a lot of cool stuff in this direction, I think
11:41 ederign joined
11:44 mojjo joined
11:48 eacameron joined
11:49 louispan joined
11:54 fbergmann joined
12:01 <Cale> Akii: Perhaps you just want a type class?
12:02 <Akii> don't think so
12:02 <Cale> Akii: I'm not sure I understand what you mean by "exception handling" there
12:03 <Akii> Cale: https://hackage.haskell.org/package/base-4.9.1.0/docs/Control-Exception.html#v:catches
12:03 <Akii> if I understand correctly, this will try each handler to see if the exception can be handled
12:04 <Akii> Servant does this with API endpoints
12:04 <Cale> Yeah, that's using the Exception type class
12:04 <Akii> which are also type classes
12:04 <Akii> maybe I do indeed need a type class
12:05 <sbrg> Akii: I think you could do something with typeclasses and DataKinds, possibly
12:05 <Cale> To be fair, it is using the SomeException existential type which you wouldn't ordinarily have, and Typeable
12:05 <sbrg> i was actually going to come up with an example, but I something is wrong with my environment because datakinds isn't behaving as it should
12:06 <Cale> But to really know what would be a good fit, I think you'd need to have more details about the problem and how things were expected to change.
12:06 <Cale> Personally, I wouldn't hesitate just to define a sum type.
12:06 <Akii> Cale: there i'm not sure myself yet
12:06 <Akii> I've to dig deeper into type-foo and my actual problem
12:06 <Cale> Or, if the only thing which is important about all these types is that there's some way to convert them into something of type A, perhaps you just want to use A instead.
12:09 <Akii> https://kseo.github.io/posts/2017-01-20-how-servant%27s-type-safe-links-work.html
12:09 <Akii> this type family stuff is still unknown to me
12:10 Denthir joined
12:16 twopoint718 joined
12:18 chrissl joined
12:19 hexagoxel joined
12:24 fhoffmeyer joined
12:25 Pupnik joined
12:31 andrei_chifa joined
12:32 kuznero joined
12:32 <kuznero> Hi All!
12:34 <Akii> hi!
12:51 owiecc joined
13:02 pie_ joined
13:08 pie_ joined
13:10 threestrikes_1 joined
13:11 owiecc joined
13:19 merijn joined
13:28 twopoint718 joined
13:33 chlong_ joined
13:34 grayjoc joined
13:48 takle joined
13:51 owiecc joined
14:03 eacameron joined
14:14 galderz joined
14:15 freechips joined
14:15 pie_ joined
14:20 Gloomy joined
14:20 Gloomy joined
14:21 aarvar joined
14:21 aarvar left
14:23 freechips joined
14:24 snowcrshd joined
14:36 pbrant joined
14:37 Denthir joined
14:39 twopoint718 joined
14:39 mizu_no_oto_work joined
14:45 eacameron joined
14:57 NoCreativity joined
15:02 freechips joined
15:03 <Akii> hm I ended up with an "Either IOException (Either SomeOtherError a)" again
15:04 <Akii> I'd like to collapes that with a sum type for the left case "data ThingWentWrong = E IOException | AnotherError SomeOtherError"
15:04 <Akii> but that also looks ugly
15:05 owiecc joined
15:05 <Akii> nah, I've to look at error handling again
15:05 <Akii> this can't be it
15:09 <Cale> Can you handle the error condition right away?
15:09 <Akii> that's what I'm currently looking at
15:09 <Akii> my whole program just doesn't make any sense
15:09 <Cale> Well there's your problem ;)
15:09 <Cale> hehe
15:10 <Akii> forever $ deleteCode >> tryAgain
15:11 <Akii> I've bits and pieces everywhere and currently trying to connect it all up
15:11 <Akii> maybe not the best approach to develop software
15:12 <Cale> It might not be the best, but it's the only one we know. :)
15:12 conal joined
15:13 <Akii> at least the code is decoupled enough that refactoring is easy
15:14 pfurla joined
15:16 takle joined
15:20 hphuoc25 joined
15:20 <Akii> well maybe someone can help
15:20 <Akii> basically I have a set of commands and I want to execute them
15:21 <Akii> commands can fail in several ways: some domain logic violation, IO, whatever
15:21 <Akii> I've extracted the domain part into an "Either DomainError stuff"
15:22 <Akii> actually this is "IO (Either DomainError stuff)"
15:22 <Akii> so there is already double failure here
15:22 <Cale> Sometimes you might take an extra parameter which specifies how to handle an error case
15:24 <Akii> I think I'm overthinking this really hard right now
15:24 <Cale> If it's vitally important that all the error cases are dealt with, and not re-thrown as exceptions, a custom sum type probably isn't out of the question.
15:25 <Cale> It sort of comes down to how you expect the user of the thing you're defining to want to handle things
15:25 <Cale> Exceptions are good for stuff where you might want to punt on handling it until farther up (or altogether, and just let the program die)
15:26 <Akii> basically my whole domain part is side-effect free
15:26 <Akii> "free"
15:26 <Cale> Either (or a custom sum type) is good in cases where you expect the user will want to immediately deal with the condition
15:26 <Akii> as in, the whole thing is a Reader and once you stick the dependency in and execute it it's free of side-effects
15:28 <Akii> well it's actually quite simple
15:28 <Akii> command execution can have a) exceptional failure, b) domain failure or c) your result
15:28 <Akii> I make a sum type for a) and b)
15:29 <Akii> type CommandResult = Either SomeError Result
15:30 takle_ joined
15:31 netheranthem joined
15:32 NeverDie joined
15:32 mthek joined
15:33 mattyw joined
15:36 Rizy joined
15:40 takle joined
15:41 \Mike joined
16:00 owiecc joined
16:06 mattyw joined
16:11 Glooomy joined
16:16 cschneid_ joined
16:17 dgonzo joined
16:17 Gurkenglas_ joined
16:29 andrei_chifa joined
16:30 dgonzo joined
16:37 Deide joined
16:45 boris_rh joined
16:45 conal joined
16:49 conal joined
16:55 dgonzo joined
16:57 dgonzo joined
17:01 conal joined
17:05 mthek joined
17:08 dgonzo joined
17:15 andrei_chifa joined
17:21 hphuoc25 joined
17:22 dgonzo joined
17:25 Glooomy joined
17:26 owiecc joined
17:26 dgonzo joined
17:30 twopoint718 joined
17:32 fhoffmeyer joined
17:32 dgonzo joined
17:36 dgonzo joined
17:38 dgonzo joined
17:40 uglyfigurine joined
17:44 Rodya_ joined
17:49 pilne joined
18:01 greenbird joined
18:06 AndreasK joined
18:09 dedgrant joined
18:14 malaclyps joined
18:20 <xmonader> http://lpaste.net/353354 this is a pure function right?
18:21 <xmonader> in programming haskell 2nd edition i quote """The conclusion is that the function eval does not fit the pattern of effectful programming
18:21 <xmonader> that is captured by applicative functors. The applicative style restricts us to applying pure
18:21 <xmonader> functions to effectful arguments: eval does not fit this pattern because the function safediv
18:21 <xmonader> that is used to process the resulting values is not a pure function, but may itself fail."""
18:23 uglyfigurine joined
18:24 initiumdoeslinux joined
18:25 <Cale> xmonader: If you're thinking of it as if it might have been a function "Int -> Int -> Int", then it's not pure.
18:26 <Cale> But also, I'm not sure what that whole statement means.
18:27 <Cale> You can also apply effectful functions to effectful arguments with Applicative
18:27 <Cale> Well, okay, but not functions a -> f b
18:28 <Cale> A better characterisation is that you can't decide what effects should occur on the basis of the result of a computation with Applicative
18:29 <Cale> (because that's exactly what (>>=) does, so if you could do that, you'd have a monad)
18:30 <xmonader> Cale the author was trying to introduce monads in a certain situation that applicative failed
18:31 <xmonader> but my problem is isn't pure function = function without side effects? I don't see side effect in safediv
18:32 <Cale> Well, it's a fairly weak notion of "effect" we have here
18:32 <Cale> The "effect" which is going on in safediv is that it may fail by producing Nothing
18:32 nadirs joined
18:33 <Cale> So it's an effect relative to what functions Int -> Int -> Int can do.
18:33 <xmonader> uha then from that point of view all maybes functions are impure?
18:33 fhoffmeyer joined
18:34 <Cale> It might be better to come at it from the other end -- we're going to think of a value of type Maybe t as being a computation which may or may not produce a result of type t when carried out.
18:35 <Cale> and that ability to fail is the only "effect" which is present
18:35 <xmonader> makes sense :) Thanks a lot ^_^
18:40 malaclyps joined
18:48 merijn joined
18:48 djfo joined
18:49 mizu_no_oto_work joined
18:49 curious_corn joined
18:53 Gloomy joined
18:53 dpren joined
18:58 pfurla joined
18:58 delexi joined
19:00 curious_corn joined
19:06 meck joined
19:10 twopoint718 joined
19:12 simendsjo joined
19:18 conal joined
19:18 mthek joined
19:19 begriffs joined
19:20 grayjoc joined
19:22 NeverDie joined
19:26 conal joined
19:28 koneko joined
19:30 ncyellow_ joined
19:34 fhoffmeyer joined
19:36 <xmonader> what is the type safediv converted to here? in line 7? http://lpaste.net/353357
19:38 <djfo> xmonader: do you mean what is the type of `pure safediv`?
19:38 <xmonader> yes
19:39 <djfo> `<*>` has type
19:39 <djfo> (<*>) :: Applicative f => f (a -> b) -> f a -> f b
19:39 <djfo> so `pure` injects the function `safediv` in the functor
19:39 <monochrom> pure safediv :: Maybe (Int -> Int -> Maybe Int)
19:39 <monochrom> pure safediv = Just safediv
19:40 <xmonader> thanks guys :) I really wished that book included annotations -_-
19:41 <monochrom> Also, pure safediv <*> whatever = safediv <$> whatever
19:42 <monochrom> I actually have trouble believing that the whole thing typechecks. You're looking at Maybe Int vs Maybe (Maybe Int)
19:42 tapirus joined
19:42 coderpath joined
19:43 <dpren> in Cabal, how much does "pkgconfig-depends" do? Does it fetch dependencies and install or compile them?
19:44 <dpren> I'm looking at line 66 here https://github.com/acowley/ffmpeg-light/blob/master/ffmpeg-light.cabal
19:50 curious_corn joined
19:54 <geekosaur> dpren, all it does is check what the pkg-config command has to say
19:54 <geekosaur> (roughly the C equivalent of ghc-pkg)
19:55 <geekosaur> it doesn't know how to operate your package manager, what a pkgconfig package maps to therein, how to install C devel headers/libraries, etc.
19:59 <tapirus> is there any function that, given two arrays of (potentially) unequal length, returns the subarray consisting of the longer array, with the first n elements dropped, where n is the length of the shorter array
19:59 <tapirus> e.g. remainder [0,1,2,3,4] [0,10,20]
19:59 <tapirus> [3,4]
20:00 djfo left
20:01 mattyw joined
20:02 <dpren> @geekosaur okay thanks. So basically it just prints the output or?
20:02 <lambdabot> Unknown command, try @list
20:03 <geekosaur> dpren, it just checks if pkg-config succeeds or not; if it succeeds then you have the dependency and can use pkg-config to find out how to build with it
20:03 <geekosaur> if not then it reports "Missing pkg-config dependency: ..."
20:05 <dpren> cool
20:07 <Geekingfrog> Is there a non infix version of >>= ?
20:07 merijn joined
20:07 conal joined
20:08 <Geekingfrog> I have f :: IO (Maybe a) and g :: a -> Maybe b. I'd like to combine that to have IO (Maybe b)
20:09 <hexagoxel> :t \a b -> [a >>= b, (>>=) a b]
20:09 <lambdabot> Monad m => m a -> (a -> m b) -> [m b]
20:10 zero_byte joined
20:11 malaclyps joined
20:12 louispan joined
20:15 louispan joined
20:16 <dpren> tapirus: is this what you want? https://en.wikipedia.org/wiki/Complement_(set_theory)#Relative_complement
20:19 takle joined
20:20 <Geekingfrog> ah, got it: join . (fmap . fmap) g
20:20 <Geekingfrog> :t join . (fmap . fmap) (undefined :: a -> Maybe b)
20:20 <lambdabot> Monad m => m (m a) -> m (Maybe b)
20:20 <Geekingfrog> \o/
20:20 <tapirus> dpren: nope, the elements of A and B might be totally different, but I just want to drop the first n characters...
20:21 <tapirus> dpren: I guess it's just remainder x y = (drop n x) ++ (drop n y) where n = min (length x) (length y), which is pretty alright (first time round when I wrote it I made it an unnecessary five lines long)
20:28 jle` joined
20:28 jle` joined
20:36 fhoffmeyer joined
20:43 albertus1 joined
20:47 andrei_chifa joined
20:48 chlong_ joined
20:49 marrenarre joined
20:50 <marrenarre> Hi.
20:50 <marrenarre> Are there any general GHC flags that beginners are recommended to use?
20:51 <benzrf> marrenarre: what kinds of things are you thinking of?
20:51 <geekosaur> -Wall
20:51 <marrenarre> ^ like that.
20:51 <marrenarre> For example with GCC I usually always have: -std=c11 -O2 -pedantic -Wall -Wextra -Werror
20:52 <marrenarre> I was thinking maybe there were some equivalent/similar things that are usually always good to have with GHC.
20:54 Rodya_ joined
20:57 <geekosaur> marrenarre, in tht sense -O or -O1 is probably a good idea, especially since haskell really badly needs optimization
20:58 <geekosaur> but I wouldn't go beyond -Wall -O until you have a better idea of what you are doing; most other options have tradeoffs you need to understand
20:59 <marrenarre> (and -Werror)
21:00 <marrenarre> ((?))
21:00 <geekosaur> possibly
21:01 <geekosaur> the warnings you get with -Wall can include compatibility warnings you may have specific reason to disregard
21:01 <marrenarre> But then I'd want to get rid of that warning.
21:01 <geekosaur> like, if you are working from nbot absolutely up to the latest tutorials, you will be warned about some changes to Monad that you shouldn't worry about right now
21:03 takle joined
21:03 <geekosaur> ...and those warnings have an annoying tendency to be version specific too. (which is another thing to watch out for, if you want code to work on any but the exact ghc version you are using, you need to disregard warnings instead of trying to silence them or you may lock yourself out of older versions)
21:03 <marrenarre> oh :(
21:03 <geekosaur> because 7.6.3 hd no idea that 7.10.3 would redo Monad as a dependent of Applicative
21:04 <geekosaur> erm 7.10.x
21:04 <marrenarre> Yeah, mien is 7.6.3.
21:04 <marrenarre> mine*
21:05 <marrenarre> Any way to get rid of the warnings that are usually unnecessary?
21:08 <marrenarre> geekosaur: So I should use optimisation level 1 rather than 2?
21:08 <geekosaur> I would say yes
21:08 galderz joined
21:09 <geekosaur> -O2 can help sometimes and hurt other times
21:09 <geekosaur> and you have to have a fairly good understanding of what's under the hood to be able to tell ahead of time which one is better
21:10 <marrenarre> Ah, I see.
21:10 <geekosaur> C is easier to optimize, but even then you can note that e.g. freebsd ports still avoids -O2 because of bugs and pessimizations
21:11 <marrenarre> In GCC I heard a lot of people use -O2 because it's well-tested and it very often gives some improvements, whereas -O3 is not necessarily better and file size increases etc..
21:11 <marrenarre> But then there's no level 3 in GHC. I guess -O2 in GCC is a bit like -O in GHC.
21:12 <marrenarre> So any way to get rid of "compatibility warnings"?
21:13 <geekosaur> not currently
21:14 <geekosaur> ghc8 is in the process of reworking warnings so that such things will in the future be easier to implement
21:14 <marrenarre> Oh, that's nice.
21:14 <geekosaur> but currently warning control is rather a blunt object, not a surgical tool
21:15 <marrenarre> Okay so -O -Wall it is.
21:15 <geekosaur> you can disable specific warnings but you have to know about them beforehand and youy may be disabling ones you want as well as ones you don'tt
21:15 <marrenarre> geekosaur: Yeah and there might be warnings on some GHC versions that I don't know about, anyway.
21:17 curious_corn joined
21:19 <marrenarre> Okay so I put -Wall there but actually there are a bunch of warnings that tell me things I don't really care about. :|
21:20 <marrenarre> Is it bad *not* to have -Wall there? I mean maybe Haskell is strict enough for me anyway. In C of course with the simpler type system the warnings can tell you about simple mistakes.
21:21 <marrenarre> I mean for example there's a certain function in my code that cannot handle an empty list, but because of how another function uses it, it will never be called with an empty list anyway. (Of course, GHC cannot know this.)
21:21 guampa joined
21:21 malaclyps joined
21:25 hphuoc25 joined
21:26 <benzrf> marrenarre: well, it's bad practice to write that kind of function anyway :p
21:26 <benzrf> putting head and tail in Prelude is almost universally acknowledged as a mistake
21:27 <benzrf> \
21:27 <nitrix> \o
21:28 <marrenarre> benzrf: But why is it bad? I know the local function will never be called with an empty list anyway.
21:29 <benzrf> marrenarre: well, you might as well argue that you know your function in a dynamically typed language will never be called with a non-int
21:29 <benzrf> or, wait - do you mean a where-binding?
21:29 <marrenarre> benzrf: I wouldn't say "as well".
21:29 <marrenarre> Yeah. Or a let binding or something.
21:29 <benzrf> ah
21:29 <benzrf> i suppose that's more ok
21:30 <benzrf> still, there's usually nicer ways to do it :)
21:30 <marrenarre> But I dunno how :(
21:30 <benzrf> yeah, alright
21:30 mizu_no_oto_work joined
21:30 <marrenarre> When the programmer's bad, no way to make good code.
21:30 <marrenarre> :D
21:31 <marrenarre> Well, I am not so good at math, but if I were, I think I'd be able to prove that the function will never be called with a non-matched value.
21:32 <marrenarre> Obviously saying that is useless since I have not actually proven it ...
21:32 <marrenarre> Well I can at least reason about it and come to the conclusion that it will not be called with non-matched values. Though I guess your opinion is that the code should be written such that the compiler is able to prove it?
21:34 <monochrom> If you find a way to eliminate the need of such a proof, that's the most ideal.
21:34 <marrenarre> Yeah.
21:34 <monochrom> Second best is you need a proof but it is trivial.
21:34 <marrenarre> Well, second best is probably good enough for me at the moment.
21:35 <monochrom> For example "map head (group xxx)" is a no-brainer because group promises non-emptiness in the inner level.
21:36 machinedgod joined
21:37 <marrenarre> Right.
21:37 fhoffmeyer joined
21:39 <marrenarre> monochrom, benzrf, geekosaur: Thanks!
21:41 <geekosaur> re -Wall, one thing this gets you is warnings about a common new Haskeller error
21:41 <geekosaur> let foo = ... in ... case bar of { Bar foo -> ... }
21:41 galderz joined
21:41 <geekosaur> this does *not* compare the inner foo to the outer, it shadows the outer and always matches.
21:42 permagreen joined
21:43 <marrenarre> You can't pattern match against variable values ever, right?
21:43 <benzrf> yup
21:43 <geekosaur> right, you need to use a guard
21:43 <marrenarre> Yeah.
21:43 <benzrf> pattern matching is only for statically-known constructors
21:43 <benzrf> and numbers, i guess
21:43 <marrenarre> Similar to both C's switch and Scheme's case.
21:44 <marrenarre> And chars.
21:45 <benzrf> chars are codepoints are numbers :>
21:45 <marrenarre> Well, the warnings I got were simpler than what I needed. I got warnings about shadowing bindings and incomplete pattern-matches, both of which I think I'm decently aware of when writing code.
21:46 <marrenarre> benzrf: In the end, everything compiles to numbers. Though in that sense everything is a number already I guess. :P
21:46 <marrenarre> benzrf: They're still their own thing syntactically though.
21:47 <benzrf> w-whatever
21:47 <benzrf> > group []
21:47 <lambdabot> []
21:47 <benzrf> ah right
21:47 <marrenarre> But the function would never be called if you mapped it over that.
21:48 <marrenarre> If you were thinking the same as me.
21:48 <benzrf> yeah
21:48 <benzrf> :)
21:48 <* marrenarre> can read minds.
21:50 conal joined
21:52 hiratara joined
21:59 gabluc joined
22:01 <gabluc> What does one do when Control.Monad.State fails to load?
22:02 <gabluc> I installed mtl and transformers through stack and I use GHC 8.0.2
22:02 <kadoban> gabluc: Fails in what way?
22:02 <kadoban> You typically don't install libraries with stack, you just write the dependency in your .cabal file and stack finds it automatically for you
22:03 <gabluc> I run a .hs file through runhaskell and it gives me an error "Failed to load interface for ‘Control.Monad.State’"
22:03 <geekosaur> you need to use stack exec, or just stack whatever.hs
22:04 <geekosaur> stack installs libraries for stack, not for bare ghc / ghci / runhaskell
22:05 moei joined
22:05 <monochrom> I wish the name "runhaskell" didn't exist. "runghc" is more specific and frank.
22:06 <gabluc> Out of frustration, I forgot about that. Thanks for the info.
22:06 nomotif joined
22:06 <monochrom> Not to mention that there are do-gooder linux distros that nondeterminizes "runhaskell" to runghc or runhugs to confuse you.
22:07 pbrant joined
22:07 t0by joined
22:07 t0by joined
22:08 <qu1j0t3> I can't imagine which one you're referring to. :)
22:09 <monochrom> ubuntu does this.
22:09 <gabluc> i think opensuse does this too
22:10 <geekosaur> that was the original idea behind runhaskell
22:12 <monochrom> The problem is that if you installed lens for GHC but couldn't do it for hugs, then "runhaskell" has 50% probability (bayesian) of not making lens available.
22:13 <monochrom> Then again it's also 50% bayesian probability of giving you better type error messages.
22:21 <gabluc> I managed to solve my difficulties. Did the dependency stuff in .cabal file and ran "stack build". I also fixed some errors in file. It related to the seventh homework in CIS194 course.
22:21 <gabluc> *in a file. It's related*
22:23 conal_ joined
22:24 cschneid_ joined
22:31 hiratara joined
22:31 idonutunderstand joined
22:37 koneko joined
22:38 fhoffmeyer joined
22:39 kmelva joined
22:39 NeverDie joined
22:40 louispan joined
22:47 ilja_kuklic joined
22:49 Denthir joined
22:51 malaclyps joined
22:56 seangrove joined
23:09 louispan joined
23:10 uglyfigurine joined
23:14 zero_byte joined
23:17 ilja_kuklic joined
23:26 hphuoc25 joined
23:26 Rizy joined
23:27 <benzrf> hugs is still actively dev?
23:28 <monochrom> No.
23:28 <monochrom> But no one talked about deving. I only talked about using.
23:29 <monochrom> Clearly Windows XP is still in active use, long after deving ended.
23:29 <benzrf> true
23:29 <monochrom> Also OS/2.
23:30 <monochrom> Hell, even OS/2 2.x is in more use than the newer versions (3 and 4).
23:33 <geekosaur> fwiw I've seen about equal amounts 2 and later (harder to tell whether they were 3 or 4 or a mix)
23:38 Gurkenglas_ joined
23:40 fhoffmeyer joined
23:43 malaclyps joined
23:45 dedgrant joined
23:45 <benzrf> jesus
23:46 <monochrom> is away
23:55 mattyw joined