<    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 24 25  
26 27 28 29 30 31
00:00 Qommand0r joined
00:00 skeuomorf joined
00:00 doyougnu joined
00:00 wtetzner joined
00:01 Levex joined
00:01 <Hafydd_> class GameServerInstanceCreatorFactory where
00:02 halogenandtoast joined
00:03 <Squarism> createGameServerInstance :: forall m1 m2 . IO (GameServerInstance m1 m2) ?
00:04 orbifx joined
00:04 <Squarism> i know im on thin ice here, but im trying to learn
00:05 sepp2k1 joined
00:06 markus1209 joined
00:06 markus1219 joined
00:09 fDev2179 left
00:10 Wizek_ joined
00:12 oisdk joined
00:13 arawack joined
00:14 mhagemeister joined
00:16 guampa joined
00:16 haennar joined
00:16 <byorgey> Squarism: the problem is that GameLauncher existentially hides the types m1 and m2. Once you put an IO (GameServerInstance m1 m2) inside a GameLauncher, you can never get it back out, because you don't know what the types m1 and m2 are anymore
00:17 <glguy> Squarism: That's a close guess, but it would mean that the user createGameServerInstance got to pick m1 and m2
00:18 <glguy> similar to how the user of 'id :: a -> a' get to pick a
00:18 <glguy> id :: forall a. a -> a
00:18 <glguy> the forall is implicit in Haskell type signatures
00:19 pickle_ joined
00:20 <Squarism> glguy, ok. i get that idea.
00:20 cmdd joined
00:20 <Squarism> byorgey, hmm.. trying to digest what you said
00:21 eacameron joined
00:22 gobrewers14 joined
00:22 pikhq joined
00:23 <Squarism> glguy, yes. Well i dont want the user of that function to decide that no.
00:23 echo-area joined
00:24 tom7942 joined
00:24 theDon_ joined
00:24 abhiroop joined
00:25 eacameron joined
00:26 vektorweg1 joined
00:27 <Squarism> woho. I got it to compile
00:27 <abhiroop> When working with Haskell STM, I know it initializes a thread local transaction log
00:27 <Squarism> pattern matching gl
00:27 <abhiroop> Can anybody tell me what data structure is this transaction log?
00:28 <abhiroop> I was trying to look for the code here : http://hackage.haskell.org/package/base-
00:28 <abhiroop> but couldn't find much
00:28 <glguy> Squarism: GOod work!
00:29 eacamero_ joined
00:30 louispan joined
00:31 clinton joined
00:31 vektorweg1 joined
00:31 <monochrom> abhiroop: It may be in the source code of the runtime system instead.
00:32 <fryguybob> abhiroop: I can fill you in on details about STM if you want.
00:33 defaultnick joined
00:34 <* hexagoxel> tries to tie a knot using a continuation, but creates a knot in his brain instead.
00:34 cyborg-one joined
00:35 <hexagoxel> is a double-continuation ever a solution? :S
00:36 <monochrom> It may comfort you to know that Cont cannot be a MonadFix instance.
00:37 abhiroop joined
00:38 eacameron joined
00:39 adam joined
00:39 <Guest55569> anyone know why I'd be getting "YAML parse exception at line 0, column 0: control characters not allowed" in stack.yaml?
00:40 <Zemyla> You know, I think I've figured out how to turn unstableSort in Data.Sequence into a stable sort.
00:40 lambda-11235 joined
00:40 nakal_ joined
00:40 <monochrom> You have control characters at line 0, column 0. The beginning. Use a hex editor to examine. Editors lie.
00:40 <Guest55569> e.g. using the example configuration of GHCJS + stack
00:40 <Guest55569> ok, thanks
00:40 <monochrom> Trust only hex editors.
00:41 path[l] joined
00:42 takle joined
00:44 eacameron joined
00:47 <Guest55569> @monochrom dunno, looks like there's nothing there
00:47 <lambdabot> Unknown command, try @list
00:48 <Guest55569> monochrom dunno, looks like there's nothing there
00:49 <monochrom> Then I don't know.
00:53 irons_ joined
00:53 johnw joined
00:54 dustmote joined
00:57 pickle_ joined
01:01 systadmin joined
01:05 oisdk joined
01:05 danthemyth joined
01:07 cdg joined
01:07 <geekosaur> Guest55569, windows? text editors often hide byte order marks, which some editors (including some versions of notepad) stick on the front to differentiate utf8 from iso8859 or other single-byte code page content
01:08 <geekosaur> notepad++ is usable and a fairly big improvement if you've been using notepad.exe
01:09 andrei_chiffa__ joined
01:10 <Guest55569> geekosaur, I am running stack from a linux VM on windows
01:11 brynser joined
01:12 eacameron joined
01:13 <Guest55569> notepad++ doesn't see anything weird, just LFs
01:13 fabianhu_ joined
01:15 <Guest55569> geekosaur ended up just saving it another file and it works, must be some kind of encoding issue. thanks.
01:15 jedws joined
01:17 sanjoyd joined
01:17 MP2E joined
01:17 <sanjoyd> Is there a way I can introduce a "scoped" type alias in Haskell? I.e. "type Name = String" but only limited to a specific function?
01:17 <sanjoyd> s/function/lexical scope/
01:17 <ezyang> sanjoyd: No, sorry :(
01:18 <sanjoyd> ezyang: thanks!
01:18 abhiroop joined
01:21 eschnett joined
01:24 buglebudabey joined
01:26 <Squarism> The final part of the puzzle im onto. How to put one existential type into a existentially typed Map? http://lpaste.net/353224
01:26 peterbecich joined
01:27 <Squarism> ...it would involve aligning 2 unknown types and i just dont feel i have a wild guess on how
01:28 tctara_ joined
01:28 janos joined
01:29 eacameron joined
01:35 dkua joined
01:37 eacameron joined
01:37 <glguy> Squarism: You don't
01:37 <Squarism> Hm ok. So this approach wont work?
01:42 Rizy joined
01:43 Levex joined
01:46 kadoban joined
01:49 <Squarism> What i. Have per-game type parameterized "GameServerInstance m1 m2". The hard part is storing these values (of different type arguments) together in an MVar
01:49 <Squarism> gah
01:50 <Squarism> correction
01:50 <Squarism> What I want to accomplish is having per-game typ parame....
01:51 hexagoxel joined
01:52 JeanCarloMachado joined
01:55 abhiroop joined
01:55 arawack joined
01:56 jmcarthur joined
01:57 Willis joined
01:59 rekahsoft joined
02:00 Rizy joined
02:01 sellout- joined
02:02 <ertes> Squarism: without going through all of your code: the dependent-map library might be interesting
02:02 <ertes> it allows value types to be given by the key
02:03 eacameron joined
02:04 theelous3 joined
02:04 <Squarism> oh ok
02:08 cdg joined
02:08 <okeuday_bak> If you use runPutM from https://hackage.haskell.org/package/binary- how is the result of type a provided?
02:10 michael3 joined
02:14 mhagemeister joined
02:15 doodlehaus joined
02:16 cschneid_ joined
02:18 timothyh joined
02:19 eacameron joined
02:19 JohnnyDown joined
02:22 systemfault joined
02:23 <Squarism> Just a hint - in 25 lines of java code what i want to accomplish in haskell : http://lpaste.net/353225
02:23 <Zemyla> Okay, so this typechecks, but what the heck does it represent?
02:23 <Zemyla> :t ContT mfix
02:23 <lambdabot> MonadFix m => ContT a m a
02:24 tom7942 joined
02:24 xaviergmail joined
02:26 <ertes> Squarism: too much noise… what does that code do that appears difficult to do in haskell?
02:27 pavonia joined
02:27 <Squarism> ertes, the hard part is having an MVar that accepts map elements of a type with different type arguments
02:27 <ertes> Squarism: explain the problem, not the solution
02:29 <ertes> in other words: explain what you're trying to do without using the words "MVar", "Map" or "type"
02:29 argent0 joined
02:30 mhagemeister joined
02:30 bjz joined
02:30 <Squarism> the problem is storing a map of GameServerInstance m1 m2 - where m1,m2 can be different for different keys + retrieving values from the same map with their original type arguments
02:30 <ertes> you're still explaining the solution
02:30 AntiSpamMeta joined
02:30 argent0 left
02:31 eacameron joined
02:32 <Squarism> problem - i want to be able to store and retrieve parameterized type values - where type parameters can be different.
02:33 <Squarism> cannot put it any shorter than that
02:34 <ertes> no, that's still part of the solution… you seem to be trying to translate a java solution to a problem into haskell, which is a recipe for sadness… what *problem* does it solve? just pretend that i'm not a programmer, then explain what you're trying to achieve
02:34 steeze joined
02:34 <ertes> you want your program to do *something*… what?
02:36 eacameron joined
02:37 <Squarism> remember my game. It mutated to become driven by messages. In and out messages. I have working thread / network code for it and all. Now i want to generify that code to accept games of different messaging models. Each game has its own in and out message types.
02:38 <ertes> do the games communicate with each other, or are you just trying to run multiple servers in a single application?
02:38 patbecich joined
02:38 <Squarism> The server kept a store of games (in an MVar) that relied on these messages - thats dependency needs to go imho.
02:39 <Squarism> no the games do not communicate
02:39 <ertes> what's the map for?
02:40 <Squarism> keeping track of : gameid <-> (channels involved in a game)
02:40 <Squarism> ...that is used for lookup when clients connect
02:40 <Squarism> ...so the right channels are given to them'
02:41 <ertes> a client connects… how does the server know which game to associate it with?
02:41 <Squarism> client connects with a gameId.
02:42 <ertes> so in principle all your map needs to contain is a mapping from game ids to whatever mechanism is necessary for the game server to communicate with the client
02:42 <ertes> in particular it doesn't need to know the precise message type… all it needs to know is how to encode/decode
02:42 <Squarism> yep
02:42 <Squarism> well
02:43 <ertes> so the map is really a map to encoders and decoders, not to a "game instance"
02:43 <Squarism> yes
02:43 <Squarism> encoders/decoders that is
02:43 bjz joined
02:43 <ertes> insisting on a concrete manifestation of "game instance" is an OO concept… you may want to get rid of that habit =)
02:44 <Squarism> ill think of that =D
02:45 conal joined
02:46 mhagemeister joined
02:46 eacameron joined
02:46 <ertes> try to think less in "objects" or "instances"… think in terms of behaviours… and don't insist on uniform representations… for example a "player" doesn't have to be (and perhaps shouldn't be) an value of type Player; it may manifest differently depending on context
02:47 <ertes> in a map of all currently active game objects, it may manifest simply as something with a position and a rendering function
02:49 <Squarism> What i refered to as GameServerInstance is really 2 types of channels. 1 to game, N to players.
02:50 <Squarism> both type parameterized depending on game implementation
02:51 eacameron joined
02:51 systadmin joined
02:53 tasmo1 joined
02:55 <ertes> why do you need a message type to begin with?
02:56 centril joined
02:58 eacameron joined
02:58 centril joined
02:59 ub joined
03:00 hucksy_ joined
03:01 <Squarism> It felt natural when i had just one game. Played well with AEson to/from json. Plus both in and out messages could be of "control" messages that needed to be inspected in networking/game loop.
03:02 <Squarism> But i understand what you mean. I could delegate decoding / encoding to games themselves
03:02 Rizy joined
03:02 shaal joined
03:02 <Squarism> and have one generic message type for all games
03:02 <Squarism> doable
03:02 <Squarism> maybe
03:03 <srk> yeah. I'm trying similar thing
03:03 Textmode joined
03:04 michael3 joined
03:04 <srk> I have plain text messaging implemented that I want to combine wih serialization
03:04 <srk> so nodes can use any protocol over that
03:04 aradia joined
03:09 fabianhu joined
03:09 mizu_no_oto joined
03:11 <Squarism> ertes, thanks for taking your time. As i have no better ideas ill persue that
03:11 drostie joined
03:12 hexagoxel joined
03:18 Rainb joined
03:19 wei2912 joined
03:20 wlemuel joined
03:21 zcourts joined
03:22 doodlehaus joined
03:23 odyjm joined
03:25 jsgrant- joined
03:27 Levex joined
03:29 tommd joined
03:31 takle joined
03:32 codesoup joined
03:33 der_landgraf joined
03:34 xaviergmail joined
03:35 wei2912 joined
03:39 castlelore joined
03:39 castlelore joined
03:39 systemfault joined
03:42 castlelore joined
03:42 castlelore joined
03:42 sdothum joined
03:44 ryr3 joined
03:44 raycoll joined
03:46 emmanuel` left
03:47 <NeverDie> Hey if anyone's interested, there's an FP Discord server up as well: https://discord.gg/FvT2Y5N
03:48 ljc joined
03:48 benl23 joined
03:49 <glguy> We're good, thanks though
03:49 systadmin joined
03:50 <pacak> NeverDie: What's wrong with irc?
03:50 <NeverDie> Nothing, I use both at the same time.
03:50 <pacak> NeverDie: Are there any discord clients that use less than 1Mb memory?
03:51 <NeverDie> Not sure why everyone assumes one must be given up to use the other when both can be used together just fine.
03:51 Vivek joined
03:52 daddychevere joined
03:54 andrei_chiffa_ joined
03:55 castlelore joined
03:55 castlelore joined
04:00 systadmin joined
04:00 exferenceBot joined
04:01 eklavya joined
04:03 systadmin joined
04:03 tel joined
04:03 tel joined
04:04 ryr3 joined
04:04 tel joined
04:04 ryr3 left
04:05 hexagoxel joined
04:05 lspitzner joined
04:05 tel joined
04:06 <ertes> license says "unfree"… closed
04:07 <ertes> if you're trying to fragment the community even more, at least promote free solutions
04:10 cdg joined
04:10 andrei_chiffa__ joined
04:10 alx741 joined
04:11 Wizek_ joined
04:11 _kit_ joined
04:16 dymatic joined
04:17 systemfault joined
04:17 sellout- joined
04:19 Micamo joined
04:19 systemfault joined
04:20 otto_s_ joined
04:22 zcourts joined
04:22 afarmer joined
04:24 FreeBirdLjj joined
04:26 sdothum joined
04:27 Volt_ joined
04:29 systemfault joined
04:29 nomotif joined
04:31 systemfault joined
04:32 <monochrom> When will someone advertise a Facebook group? :)
04:34 systemfault joined
04:35 drostie joined
04:37 systemfault joined
04:40 systemfault joined
04:40 takle joined
04:44 eklavya joined
04:46 mhagemeister joined
04:47 xaviergmail joined
04:47 patbecich joined
04:50 takle joined
04:52 kini joined
04:52 lambdafan joined
04:53 <lambdafan> can we have dependently typed pairs in haskell?
04:53 <ertes> lambdafan: see the dependent-sum library
04:54 <lambdafan> nice, thanks :)
04:56 LiaoTao joined
04:56 <lambdafan> perfect!
04:57 pleax joined
04:57 patbecich joined
04:57 systadmin joined
04:59 systadmi1 joined
05:01 systadmi1 joined
05:02 takle joined
05:02 mhagemeister joined
05:03 defaultnick joined
05:04 lambdafan joined
05:04 yrdz joined
05:05 thunderrd__ joined
05:06 jsgrant-_ joined
05:07 bjz joined
05:10 doyougnu joined
05:23 markasoftware joined
05:23 zcourts joined
05:24 fizruk joined
05:25 takle joined
05:26 conal joined
05:26 dezren39 joined
05:37 <eklavya> what is ~() here "~(f, s') <- mf s" ?
05:39 <eklavya> if this is not something in the syntax
05:39 <eklavya> context:
05:39 <eklavya> StateT mf <*> StateT mx = StateT $ \ s -> do
05:39 <eklavya> ~(f, s') <- mf s
05:39 <eklavya> ~(x, s'') <- mx s'
05:39 <eklavya> return (f x, s'')
05:41 Xanather joined
05:41 humboldt joined
05:43 <S11001001> eklavya: it means, don't force the tuple as part of pattern matching; instead, that f x gets turned into (fst theFirstTuple) (fst theSecondTuple)
05:43 <eklavya> S11001001: sorry, not getting you
05:43 <S11001001> eklavya: https://en.wikibooks.org/wiki/Haskell/Laziness#Lazy_pattern_matching
05:43 <eklavya> S11001001: thanks :) let me read that
05:44 _sg joined
05:48 Rizy joined
05:49 dramforever joined
05:49 Wizek_ joined
05:50 Whitesquall joined
05:50 systadmin joined
05:51 <geekosaur> pattern matching normally forces immediate evaluation in order to see if the value matches. a lazy pattern match instead defers that evaluation like any other lazy evaluation
05:51 <geekosaur> (evaluation only to the extent needed to see if the pattern matches)
05:52 pera joined
05:57 takle joined
05:58 pleax joined
05:58 patbecich joined
06:00 defaultnick joined
06:00 hexagoxel joined
06:02 halogenandtoast joined
06:04 raycoll joined
06:05 systadmin joined
06:10 drostie_ joined
06:11 danthemyth joined
06:11 cdg joined
06:16 HEGX64 joined
06:19 <Wizek> Hey! Anyone here who has experience with setting up reflex(-dom) with stack (and hopefully without involving nix)?
06:19 <Wizek> I've tried with lts-6.30 and I got a compile-time type error related to the cairo package
06:19 <Wizek> completely fresh start with `stack new`
06:20 <dymatic> No experience with the stack, sorry Wizek. What kind of type error is it?
06:21 chenshen joined
06:21 <Wizek> sec, pasting it somewhere
06:21 plutonux[r] joined
06:22 geekosaur joined
06:22 TxmszLou joined
06:23 thatguy joined
06:23 <Wizek> dymatic, https://gist.github.com/Wizek/b2af32bd9d4aa1486dac5a93f5d0c2e6
06:23 ramzifu joined
06:24 zcourts joined
06:24 v4hn joined
06:24 chenshen joined
06:26 <dymatic> Damn that doesn't seem right
06:26 <dymatic> If this is going through cabal and still giving you that error, someone's package file somewhere is goofed
06:26 <dymatic> Or some version of something (maybe cabal) is out of whack
06:27 arawack joined
06:27 <Wizek> dymatic, Yes, afaik stack uses cabal-install underneath
06:28 <Wizek> I have a hunch that I might need to specify to use GHCJS instead of GHC somewhere.
06:28 <geekosaur> not quite but it does use the Cabal library underneath
06:28 <geekosaur> this looks like there is a mismatch of Cabal versions somewhere
06:29 <dymatic> Maybe even try a "cabal install cabal"
06:29 janos joined
06:30 defaultnick joined
06:31 shaal joined
06:32 louispan joined
06:33 Beetny joined
06:35 takle joined
06:35 unmanbearpig joined
06:39 <lispy> I think you mean Cabal
06:41 chenshen joined
06:44 FreeBirdLjj joined
06:46 Edith joined
06:49 SeMas joined
06:53 Kreest__ joined
06:53 minn joined
06:53 benl23 joined
06:54 howdoi joined
06:57 takle joined
06:59 pleax joined
06:59 michbad joined
06:59 jsgrant joined
07:00 FreeBirdLjj joined
07:00 mbw joined
07:00 hexagoxel joined
07:01 systadmin joined
07:01 tsmish joined
07:02 mhagemeister joined
07:02 takuan joined
07:03 defaultnick joined
07:04 takle joined
07:04 <mbw> Hello, I have another question about the FFI. According to https://ghc.readthedocs.io/en/8.0.1/ffi-chap.html#memory-allocation, among the functions in Foreign.Marshall.Alloc, alloca should be used when possible. However, the documentation on this (and similar functions like allocaArray) is not really exhaustive. Does alloca have anything to do with alloca from <alloca.h>? If so, can I assume it is not
07:04 <mbw> portable and I an blow out the stack?
07:04 <mbw> *can
07:07 JuanDaugherty joined
07:07 iomonad joined
07:08 benl23 joined
07:09 dezren39 joined
07:13 emmanuel_erc joined
07:13 mendez joined
07:16 humboldt joined
07:18 pacak joined
07:20 mhagemeister joined
07:20 path[l] joined
07:22 thatguyfrombefor joined
07:25 eacameron joined
07:26 zcourts joined
07:26 frug72 joined
07:28 louispan joined
07:30 jluttine joined
07:31 thatguyfrombefor joined
07:31 <cocreature> mbw: afaik it has nothing to do with alloca.h. it allocates on the heap and is portable
07:31 <cocreature> but I might be wrong here
07:32 <mbw> I tried it with 5000 doubles, which should've given some indication if it really was using alloca.
07:33 recur22 joined
07:33 <mbw> oh wait
07:34 fnurglewitz joined
07:34 eacameron joined
07:35 <mbw> That's only 39kb. Still, it should be easily checkable if I go over 8192kb.
07:35 <mbw> At least that's the stack size limit on my machine
07:36 <mbw> But probably, if this function was in any way dangerous, there would probably be a warning.
07:36 unmanbearpig joined
07:37 mohsen_ joined
07:37 <glguy> alloca from C is different from GHC
07:38 sternmull joined
07:40 hazmat_ joined
07:41 systadmin joined
07:41 dan_f joined
07:42 <recur22> why every haskell library has to be special and has its own unique DSL?
07:43 cads joined
07:43 <recur22> unnecessary monadic
07:44 systadmin joined
07:45 eacameron joined
07:45 hexagoxel joined
07:46 michbad joined
07:47 SpinTensor joined
07:47 <recur22> i'm looking haskage trying to find good library for teaching but all i can find is either bindings or unnecessarily verbose package
07:49 takle joined
07:49 jtcs joined
07:49 pacak joined
07:53 thatguyfrombefor joined
07:53 <mbw> Is it a convention that Haskell array code is done using indices starting at 1? I get the impression from the tutorials I've been looking at.
07:54 eacameron joined
07:55 cschneid_ joined
07:58 systadmin joined
07:58 eacamero_ joined
07:59 pleax joined
08:00 patbecich joined
08:00 defaultnick joined
08:00 augur joined
08:02 calincru joined
08:02 unmanbearpig joined
08:02 takle joined
08:02 eacameron joined
08:03 <Cale> mbw: There's no convention -- Ix lets you choose whatever bounds make the most sense for your application.
08:03 <Cale> (if you want to start an array at 137, you can do that)
08:04 <Cale> 0 would usually be preferred, all else being equal though
08:05 Ch3ck joined
08:06 plutoniix joined
08:08 spatial joined
08:08 nwf joined
08:08 Wizek_ joined
08:09 eacameron joined
08:10 takle joined
08:10 <spatial> http://pastebin.com/LxzCpQgE I have errors in this code.
08:10 <spatial> Trying a State Monad to store a global array.
08:10 insitu joined
08:10 srbaker_ joined
08:10 <spatial> storearray "value-table" ( newArray (512,512) 0 ) has a problem.
08:11 pantsman_ joined
08:13 ragepandemic joined
08:14 <spatial> I guess the pattern will work if I remove the errors.
08:15 FjordPrefect joined
08:15 eacameron joined
08:17 ferlif joined
08:17 <ferlif> ciao
08:17 mada joined
08:18 <mbw> Cale: Ok, that's good to know.
08:20 freusque joined
08:22 insitu joined
08:24 <cocreature> mbw: these days https://hackage.haskell.org/package/vector is arguably the most common implementation of arrays and it uses 0 based indices
08:27 zcourts joined
08:27 gk-1wm-su joined
08:29 gk_1wm_su joined
08:30 roundhouse joined
08:33 defaultnick joined
08:33 oleksiyp joined
08:33 xinming joined
08:34 <roundhouse> hi, how can I reference a type of the sourrounding environment? If I have "f :: (Monad m) => m (); f = g; where g :: m ()...) I get an error that the the monad of g m1 can't be matched with the one of f.
08:37 beanbagula joined
08:38 jle` joined
08:39 eacameron joined
08:40 takle joined
08:48 mendez joined
08:48 raichoo joined
08:49 <spatial> http://pastebin.com/mQcJJ4f5 I've changed and now the last function 'BoardState' has errors. Why ?
08:49 <spatial> * Couldn't match type `(,) (Maybe (IOArray Int Int))' with `IO'
08:51 eacameron joined
08:51 lithie joined
08:55 eacameron joined
08:55 jtcs joined
08:58 takle joined
08:59 hexagoxel joined
09:00 zcourts joined
09:00 eacameron joined
09:00 pleax joined
09:01 <cocreature> spatial: putmutablearray first calls "newArray" so the do block has to be of type IO a for some a, but then it calls storearray which is of type State … … but State and IO are not the same thing
09:01 <cocreature> roundhouse: enable ScopedTypeVariables and change the signature of f to "f :: forall m. (Monad m) => m ()"
09:02 systadmin joined
09:02 lavalike joined
09:03 eacamero_ joined
09:03 <roundhouse> cocreature: Thank you, I'll have to read up on that extension
09:05 xinming joined
09:05 <spatial> Should that be split into two ?
09:06 mda1 joined
09:06 <roundhouse> cocreature: Exactly what I was looking for :)
09:07 averell joined
09:07 rgc joined
09:09 eklavya joined
09:12 coot joined
09:13 initiumdoeslinux joined
09:14 deepfire joined
09:15 Rizy joined
09:16 Detrumi joined
09:16 srbaker_ joined
09:16 dustmote joined
09:19 Aune joined
09:19 jtcs joined
09:21 takle joined
09:23 ilja_kuklic joined
09:26 deepfire joined
09:28 rixile joined
09:29 gfixler joined
09:31 jchia joined
09:31 xaviergmail joined
09:33 simukis__ joined
09:33 hrehf joined
09:35 <spatial> Should I split putmutablearray = do { arr <- newArray (512,512) 0 ; storearray "value-table" arr } into two ?
09:35 connrs joined
09:35 jomg joined
09:35 jchia joined
09:36 <spatial> The idea is to store an array using the State Monad. And read and write.
09:37 marr joined
09:37 jgertm joined
09:39 wlemuel joined
09:39 takle joined
09:39 t0by joined
09:39 t0by joined
09:39 <spatial> Can I see an example that correctly does what I am doing http://pastebin.com/mQcJJ4f5?
09:40 coot joined
09:40 hamid joined
09:40 thc202 joined
09:41 chaosmasttter joined
09:42 cyborg-one joined
09:42 Jicoss joined
09:43 gk_1wm_su joined
09:44 louispan joined
09:46 hackebeilchen joined
09:46 jchia joined
09:48 zcourts joined
09:48 jchia joined
09:49 insitu joined
09:49 jchia joined
09:52 mmn80 joined
09:52 takle joined
09:54 HEGX64 joined
09:57 ramzifu joined
09:57 zdenal joined
09:59 zcourts_ joined
10:00 haennar joined
10:01 patbecich joined
10:01 pleax joined
10:01 Destol joined
10:03 systadmin joined
10:03 byte512 joined
10:04 halogenandtoast joined
10:04 Gurkenglas joined
10:06 orbifx joined
10:08 danvet joined
10:09 mda1 joined
10:09 simendsjo joined
10:09 fractalsea joined
10:09 mannen joined
10:10 Fairy joined
10:11 esad joined
10:12 nek0 joined
10:13 jomg joined
10:13 Rainb joined
10:14 janos joined
10:15 louispan joined
10:16 Nerterologist joined
10:19 dreco joined
10:20 oisdk joined
10:22 steshaw joined
10:25 hexagoxel joined
10:27 mda1 joined
10:28 takle joined
10:29 catsup joined
10:30 catsup joined
10:34 emmanuel_erc joined
10:38 thatguyfrombefor joined
10:38 ner0x652 joined
10:43 insitu joined
10:43 pleax joined
10:44 insitu joined
10:44 FreeBirdLjj joined
10:47 halogenandtoast joined
10:48 ph88 joined
10:48 oaao joined
10:49 cdg joined
10:50 Danny_ joined
10:50 <Danny_> Anyone on?
10:51 <int-e> ...
10:51 mstruebing joined
10:51 <suppi> ..
10:52 systadmin joined
10:52 <Xnuk> .
10:55 krauq joined
10:56 mjs2600 joined
10:56 insitu joined
10:57 silver joined
10:58 <dyreshark>
10:58 deepfire joined
10:58 eklavya joined
10:58 binaryplease joined
11:00 Jackneill_ joined
11:01 krauq joined
11:03 mohsen_ joined
11:08 Berra joined
11:09 hexagoxel joined
11:10 janos joined
11:10 aregidor joined
11:10 <aregidor> hi
11:11 lukaramu joined
11:11 srbaker_ joined
11:11 eSko joined
11:12 <eSko> https://www.youtube.com/watch?v=ZFxqjZ2H9yE
11:13 mounty joined
11:13 <aregidor> somebody knows what's the problem with this program? http://pastebin.com/fzwk41Zp
11:13 <aregidor> I obtain:
11:14 <aregidor> a.hs:9:21:
11:14 <aregidor> Couldn't match expected type `String -> String'
11:14 <aregidor> against inferred type `[Char]'
11:14 <aregidor> Probable cause: `showString' is applied to too many arguments
11:14 <aregidor> In the first argument of `Endo', namely `(showString t)'
11:14 minn joined
11:14 <aregidor> In the expression: Endo (showString t)
11:14 Fendor joined
11:15 Gazump_ joined
11:16 nadirs joined
11:18 binaryplease joined
11:19 ludat joined
11:20 soLucien joined
11:20 danthemyth joined
11:22 humboldt joined
11:23 louispan joined
11:23 Uakh joined
11:25 augur joined
11:26 <Xnuk> :t Endo
11:26 <lambdabot> (a -> a) -> Endo a
11:26 cokanut joined
11:26 <Xnuk> :t showString
11:26 <lambdabot> String -> ShowS
11:27 <Xnuk> so (a -> a) is ShowS, which is String -> String
11:27 <Xnuk> so you'll get Endo String
11:27 <Xnuk> aregidor:
11:27 LeCamarade joined
11:27 <aregidor> Xnuk: yes
11:28 <aregidor> mmm
11:28 paolino joined
11:28 <aregidor> aaah, ok
11:28 <aregidor> thanks, Xnuk
11:30 Fairy joined
11:31 systadmin joined
11:33 petrus joined
11:34 Miroboru joined
11:35 amuck joined
11:35 humboldt joined
11:35 janos joined
11:41 louispan joined
11:42 tctara_ joined
11:45 vadimich joined
11:46 Cassiopaya joined
11:46 ziocroc joined
11:49 psychicist__ joined
11:49 zeroed joined
11:49 zeroed joined
11:49 eklavya joined
11:49 Rainb joined
11:50 boombanana joined
11:50 systadmin joined
11:51 louispan joined
11:51 paolino joined
11:52 FreeBirdLjj joined
11:56 systadmin joined
11:57 systadmin joined
11:58 hexagoxel joined
12:01 bjz_ joined
12:02 paolino joined
12:02 simukis__ joined
12:02 JeanCarloMachado joined
12:02 patbecich joined
12:04 systadmin joined
12:04 humboldt joined
12:06 Jicoss joined
12:07 contiver_ joined
12:08 kuribas joined
12:08 Jicoss joined
12:09 Jicoss joined
12:09 <kuribas> How do I skip an expression in the ghci debugger? :force doesn't seem to work...
12:09 <kuribas> I am using :step to step through the expression.
12:10 aregidor joined
12:10 <kuribas> Also why can I not inspect the whole environment in the debugger?
12:10 staafl joined
12:11 <kuribas> It only allows me to inspect variables in the expression under focus.
12:11 jtcs joined
12:13 magneticduck joined
12:14 mohsen_ joined
12:14 mthek joined
12:16 biglama joined
12:18 Kreest_ joined
12:19 connrs joined
12:20 abhiroop joined
12:21 netheranthem joined
12:21 lysgaard joined
12:22 lysgaard joined
12:24 dramforever_ joined
12:26 systadmin joined
12:27 egis joined
12:27 <abhiroop> Can anyone tell me how haskell STM or STM in general deals with Reentrancy?
12:27 lep-delete joined
12:28 <hpc> it doesn't
12:28 <hpc> look at the docs for unsafeSTMToIO
12:29 <hpc> rather, https://hackage.haskell.org/package/base-
12:30 <hpc> also https://hackage.haskell.org/package/base-
12:31 twanvl joined
12:33 deepfire joined
12:33 insitu joined
12:34 magneticduck joined
12:36 <dramforever> abhiroop: STM actions are always reentrant, as long as you don't use 'unsafeIOToSTM' &friends
12:37 bjz joined
12:38 Jicoss joined
12:38 <abhiroop> dramforever: "STM actions are always reentrant" -> Could you please elaborate on this?
12:39 <abhiroop> In fact 'unsafeIOToSTM' which hpc pointed seems to be the only thing handling reentrancy
12:40 cschneid_ joined
12:44 oisdk joined
12:44 revprez_atlanta joined
12:47 systadmin joined
12:48 egis joined
12:49 <dramforever> abhiroop: What things can be non-reentrant?
12:50 <dramforever> Well, writeTVar, you can think of those writes as batched all the way to completion
12:50 <dramforever> And the changes are applied only if non of the results of the reads changed
12:50 <dramforever> It's like a super CAS loop
12:51 t7 joined
12:51 <abhiroop> dramforever: yes I am aware of the working of STM transactions
12:52 <abhiroop> In fact I was going through the composable transactions paper by SPJ, Simon Marlow et al when I was wondering about reentrancy
12:52 <abhiroop> No where in the paper they discuss reentrancy
12:52 <abhiroop> "What things can be non-reentrant?" -> Well any pure function
12:52 <dramforever> ?
12:53 <abhiroop> I just want to clarify my definition of reentrancy
12:53 <dramforever> abhiroop: Can you give an example of where this is a problem?
12:54 <abhiroop> When a concurrent object itself actively yields without being preempted by the scheduler
12:54 xaviergmail joined
12:54 <abhiroop> and talks to another cncurrent object
12:55 <dramforever> Huh
12:55 <abhiroop> which reenter the control flow back to the original concurrent object
12:55 <dramforever> "concurrent object" -> like thread?
12:55 <abhiroop> So obj A -> obj B -> obj A
12:55 comingsoon joined
12:55 <abhiroop> Isn't that reentrancy
12:56 <abhiroop> A TVar
12:56 janos joined
12:56 <dramforever> Data doesn't have control flow don't they
12:56 <dramforever> s/don't/does
12:56 <dramforever> Damn I can't English
12:57 <abhiroop> Yes you are right
12:57 <dramforever> abhiroop: What do you mean by reentering the control flow back to some piece of data?
12:57 <abhiroop> Actually let me try to reframe my thoughts
12:57 <abhiroop> As you were telling
12:57 <abhiroop> A thread
12:57 <abhiroop> yes the control flow of a thread
12:58 <abhiroop> So Thread 1 -> Thread 2 -> Thread 1
12:58 <abhiroop> Is that reentrancy?
12:58 <dramforever> Yes it is
12:58 <dramforever> it goes like this:
12:58 <abhiroop> Cool
12:58 <dramforever> We have a TVar holding 1
12:58 <abhiroop> so any form of communication between the threads where there is yielding of control
12:58 <dramforever> Thread1 reads it, gets 1, but before the STM action completes, we switch to Thread2
12:58 <abhiroop> How do I get that to work?
12:59 <dramforever> Oh wait, *without* being preempted
12:59 <abhiroop> "we switch to Thread2" -> you mean the scheduler
12:59 <abhiroop> Oh wait, *without* being preempted -> EXACTLY
13:00 <dramforever> abhiroop: You can't really do that in STM
13:00 <dramforever> You have to do that in IO
13:00 <dramforever> STM transactions are meant to be small and quick
13:00 <abhiroop> and so use https://hackage.haskell.org/package/base-
13:00 <abhiroop> ?
13:01 vektorweg1 joined
13:01 <dramforever> abhiroop: The third bullet point in that
13:01 <dramforever> That's the problem, I suppose
13:01 spatial joined
13:01 <abhiroop> Yes this "Invariants that you expect to be true throughout your program may not be true inside a transaction, due to the way transactions are implemented."
13:01 zeroed joined
13:01 zeroed joined
13:02 phyrex1an joined
13:02 <dramforever> So it doesn't handle the thing you call reentrancy
13:02 <dramforever> (I would call it 'coroutine')
13:02 <abhiroop> I am very used to lock based concurrency and using Reentrant locks
13:02 <abhiroop> "(I would call it 'coroutine')" -> Yes
13:02 <abhiroop> Thanks dramforever
13:02 zeawee joined
13:03 <spatial> putmutablearray = do { arr <- newArray (512,512) 0 ; storearray "value-table" arr } IO and IOArray Int Int Should I split into two ?
13:03 <dramforever> abhiroop: When I use STM I send messages between threads through stuff like TChan
13:03 zeawee joined
13:03 <zeawee> C
13:03 <dramforever> Not 'tell the other thread to work' directly
13:04 <abhiroop> Oh..
13:04 <abhiroop> Well actually thats what I was getting at
13:04 <abhiroop> how do you solve for cases which involves reentrancy
13:04 <spatial> Anyone can suggest error fixes for my code http://pastebin.com/mQcJJ4f5 ?
13:05 <dramforever> abhiroop: That makes me wonder
13:05 <dramforever> Why are you using two threads?
13:05 <abhiroop> Well actually no I am not.
13:05 <dramforever> Then, huh?
13:06 <abhiroop> Like I said I was reading the paper Composable Transactions and wondering about handling reentrancy
13:06 <abhiroop> :)
13:06 vadimich joined
13:06 <dramforever> Well
13:06 zoug joined
13:06 <dramforever> That's like reading a baking tutorial and asking 'What about the bacon'?
13:06 <contiver_> is there a way to get a list of constructors from a data type? I'm aware that if constructors take a different amount of parameters, then the list wouldn't be homogeneous and it would usually not be possible. But in my case it's a bunch of unary constructors, so I thought maybe there is a work around.
13:06 <dramforever> '? -> ?'
13:07 <abhiroop> yeah true :)
13:07 <contiver_> Tried with Data.Data and Data.Typeable, but dataTypeConstrs gives a list of [Constr], not what I'm looking for :/
13:07 janos joined
13:08 zeroed joined
13:08 <abhiroop> dramforever: But I guess its not very difficult to think about cases of reentrancy
13:08 <abhiroop> On the top of my mind
13:09 <abhiroop> some mutually recursive function operating in a multi threaded environment
13:09 <contiver_> I need to list the constructors for an Arbitrary instance, and would prefer to avoid repeating them (to keep a single source of truth)
13:09 yumh joined
13:12 wlemuel joined
13:13 atz__ joined
13:14 zeawee left
13:14 Levex joined
13:14 zeawee joined
13:14 melancholiac joined
13:15 Marqin joined
13:15 <melancholiac> why does ghc package is so big (1146.92 MiB)?
13:15 lspitzner joined
13:16 boombanana joined
13:17 justanotheruser joined
13:19 zeawee joined
13:20 <bjobjo> quick and stupid question: does GHC only consider 8 spaces valid indentation? I can't seem to make my nested where's work with 4.
13:20 fuzzy_id joined
13:22 <spatial> IO ( IOArray Int Int) to IOArray Int Int Get newArray and store in Map Is that possible ?
13:22 takle joined
13:23 <Fendor> bjobjo, if i'm right in memory, it doesn't matter as long the indentations match up with the other lines
13:23 <Fendor> so 4 should be fine, 2 should be fine
13:23 <Fendor> never tried 3
13:23 <Fendor> oder one
13:24 _sg joined
13:24 <bjobjo> that's weird, I believe my editor has been set up with soft tabs everywhere, but I'll have to check with vim or something
13:25 <Fendor> do manual spaces, then youll see whats the problem
13:25 <bjobjo> looks all right in vim too, all spaces everywhere (I've had troubles with mixed tabs/spaces before)
13:25 insitu joined
13:26 melancholiac left
13:26 melancholiac joined
13:26 <contiver_> bjobjo, if you can show us the code, we might be able to find out why.
13:26 <bjobjo> one sec
13:28 <lpaste_> bjobjo pasted “nested where indentation issues” at http://lpaste.net/353233
13:28 robotroll joined
13:28 <contiver_> bjobjo, if I'm not mistaken, you need to indent the 2nd where past the 1st one
13:29 <bjobjo> oh, so since where is 5 chars, 4 spaces is not enough?
13:29 <Tuplanolla> This also applies to statement-let, bjobjo.
13:29 systadmin joined
13:30 <contiver_> bjobjo, my understanding is that the column for the first where's definitions starts where mapOperatingSystem starts
13:30 <hexagoxel> bjobjo: the "mapOS .." defines the indentation level for the where-decls. But the second where goes left of that.
13:31 <contiver_> not sure if it would work just below it, but probably a single space after it, works.
13:31 <hexagoxel> ^
13:32 <hexagoxel> you can decrease overall indentation by newline after first where.
13:32 <contiver_> also, you can avoid the second where. Just define both functions under the first one, it should also work, and is cleaner (IMO).
13:33 <bjobjo> all right, let me try it out a bit
13:33 <bjobjo> thanks all :)
13:33 lukaramu_ joined
13:33 <lpaste_> hexagoxel annotated “nested where indentation issues” with “nested where indentation issues (annotation)” at http://lpaste.net/353233#a353234
13:34 theelous3 joined
13:34 <bjobjo> in this particular case, skipping the second where certainly looks better
13:36 ph88 joined
13:37 HaeB1 joined
13:37 theelous3 joined
13:39 mekeor joined
13:39 vadimich joined
13:40 vadimich joined
13:48 jgertm joined
13:48 defaultnick joined
13:48 slack1256 joined
13:48 abhiroop joined
13:50 takle joined
13:51 sdothum joined
13:51 soLucien joined
13:52 hamid joined
13:53 janos joined
13:54 Levex joined
13:55 furfy joined
13:57 <Squarism> Did not thing order of declaration didnt matter in haskell? like if i declare A after B, where A is used i should not get an error?
13:57 bollu joined
13:57 <Squarism> think
13:57 <bollu> what is a cute library for pretty printing?
13:57 iulian joined
13:58 ramzifu joined
13:58 <Theophane> Squarism: I don't think so. Due to lazyness, if you don't have to use B before A is declared, it will work
13:58 Guest4561 joined
13:59 Guest4561 left
14:00 defaultnick_ joined
14:00 janos joined
14:01 systadmin joined
14:01 <Squarism> Theophane, here (http://lpaste.net/353236) i get a compile error on line 28 "Not in scope: type constructor or class ‘OAuthProviderId’" ..which is declared on line 157
14:02 ragepandemic joined
14:02 <Theophane> okay
14:02 tomboy64 joined
14:02 beanbagula joined
14:03 systadmin joined
14:03 <pavonia> Squarism: I think this is due to the use of TH
14:03 <Squarism> pavonia, oh ok.
14:03 Jesin joined
14:03 janos joined
14:03 <mniip> Theophane, laziness is unrelated
14:03 takle joined
14:04 <Theophane> ok
14:04 patbecich joined
14:04 <Squarism> pavonia, is there any workaround - sure i could move stuff - but it would be nice to keep things in their sections
14:04 contiver joined
14:04 <pavonia> I'm not aware of one
14:06 <ertes> Squarism: generate the lenses *after* you have defined all types
14:06 <Squarism> oh ok
14:06 <Squarism> ertes, btw - thanks for your stubborn questioning. I followed your path and arrived at greatness! =D
14:07 <ertes> great =)
14:07 janos__ joined
14:08 <ertes> BTW, another option is not to use TH and write the lenses yourself… that option gives you the opportunity to document your lenses, too =)
14:08 hamid joined
14:08 janos joined
14:09 stoopkid joined
14:10 sternmull joined
14:11 <ertes> Squarism: regarding TH: imagine that in every line that uses top-level TH there is a "can't look ahead past here" barrier… that's why you should always define your types first when using makeLenses
14:12 PennyNeko joined
14:12 <Squarism> sounds like extra work spiced with extra work on the not most prioritized issue at hand =D
14:13 <Squarism> i understand. Lenses last it will be
14:13 <Squarism> it seems it fixed the problem too btw.
14:16 <ertes> Squarism: yeah, makeLenses is just inconvenient enough that i tend not to use it most of the time =)
14:16 <ertes> would be nice to have a restricted subset of TH that doesn't ruin lookahead
14:17 HEGX64 joined
14:17 deepfire joined
14:18 tomboy64 joined
14:18 jmcarthur joined
14:19 prophile joined
14:19 petrus joined
14:20 mkoenig joined
14:21 tomboy64 joined
14:22 dddddd_ joined
14:23 zygentoma joined
14:23 tomboy64 joined
14:25 skeuomorf joined
14:29 mjs2600 joined
14:30 <lyxia> just wait for a Generic implementation of lenses
14:30 <piyush-kurur> any one with access to openbsd + GHC
14:31 <lyxia> Squarism: see http://lpaste.net/353163
14:31 sepp2k joined
14:33 epsilonhalbe joined
14:33 <Squarism> lyxia, thats beyond my current level. It guess ill have to experiance some real problems with makeLenses first =D
14:34 <Squarism> ...before looking for alternatives
14:34 CptCaptain joined
14:34 takle joined
14:37 jomg joined
14:37 desktop joined
14:38 atz__ joined
14:39 yqt joined
14:39 ph88 joined
14:41 mYXZa781 joined
14:43 <cocreature> Bob131: wl-pprint-text is pretty nice
14:44 <cocreature> eh that was for bollu but they already left
14:44 rekahsoft joined
14:46 bollu joined
14:46 mjs2600 joined
14:46 Levex joined
14:48 halogenandtoast joined
14:49 <ertes> proposal: let's rename 'liftIO' to 'io' =)
14:49 <johnw> ertes: easy to do as a local function
14:49 <ertes> sure
14:50 zeroed joined
14:50 zeroed joined
14:50 <ertes> but a first-hand definition has soooooooooooo many advantages, you know
14:50 <ertes> like being first-hand
14:50 <ertes> and having advantages
14:51 <cocreature> I don’t think that’s a well founded definition of the advantages it provides
14:51 <ertes> if you think corecursively it is =)
14:51 mjs2600 joined
14:51 janos joined
14:52 <cocreature> are corecursive definitions also called „well-founded“?
14:54 FreeBirdLjj joined
14:54 takle joined
14:56 arkasis joined
14:59 janos joined
14:59 atz__ joined
14:59 doodlehaus joined
15:01 doodlehaus joined
15:02 <johnw> cocreature: I'm not seeing that used in the literature for the case of corecursion
15:03 <johnw> in Coq we just talk about the guardedness condition
15:03 freusque joined
15:04 takle joined
15:04 janos joined
15:05 doodlehaus joined
15:05 patbecich joined
15:07 shesek joined
15:08 wildlander joined
15:08 <lyxia> which is a heuristic for productivity
15:09 meoblast001 joined
15:10 ner0x652 joined
15:10 xubunto joined
15:11 <xubunto> is it possible to map a prefix expression such as div?
15:11 <Rembane> xubunto: Map it to what?
15:11 <johnw> lyxia: well, it's a conservative heuristic, and not just "probably productive"
15:12 <xubunto> Rembane: 2 values
15:12 <Rembane> xubunto: Yes. In a number of ways, for instance: zipWith div [1..10] [10,9..1]
15:12 <Rembane> xubunto: Or: map (`div` 10) [1..]
15:13 <xubunto> what about (map . map)"
15:13 <tomboy64> isn't it map (div 10) [1..]?
15:13 steeze joined
15:14 <xubunto> tomboy64: trying to see if there is a way to do only div
15:14 <tomboy64> xubunto: "only div"?
15:14 <xubunto> tomboy64: not div 10, only div
15:14 srbaker_ joined
15:15 fnurglewitz joined
15:15 <tomboy64> map it to what?
15:15 takle joined
15:15 <ertes> is there a way to convert an at-most-one-Traversal into an IndexPreservingTraversal? writing an IndexPreservingTraversal directly is pretty awkward
15:15 <xubunto> tomboy64: 2 lists
15:16 <tomboy64> xubunto: map (\x -> map (\y -> div x y) ylist) xlist
15:16 <Rembane> tomboy64: If you run div 10, you will divide 10 with something, if you use (`div` 10) you will divide something with ten.
15:16 <tomboy64> or [ z | div x y, x <- xlist, y <- ylist ]
15:17 <tomboy64> errr
15:17 <ertes> xubunto: what are your inputs, and what is the desired result?
15:17 zeroed joined
15:17 <tomboy64> no that can't be right
15:18 <xubunto> ertes: i would love to be able to do map div [1,2,3] [4,5,6]
15:18 <tomboy64> ertes: 2 lists. he either wants zipWith or something to create a 2d-field
15:18 <int-e> tomboy64: did you mean [div x y | x <- xlist, y <- ylist]?
15:18 janos joined
15:18 <tomboy64> int-e: exactly
15:18 <xubunto> int-e: that is list comp right?
15:18 <int-e> you could use applicatives: div <$> xlist <*> ylist
15:18 <int-e> xubunto: yes
15:19 <ertes> xubunto: and what's the desired result?
15:19 <ertes> there are a number of options
15:19 afleino joined
15:19 <xubunto> ertes: int-e got it
15:19 <lyxia> johnw: could we say guardedness is to productivity as well-foundedness is to termination?
15:20 <xubunto> i wanted to see if i could use <$> and <*> with a prefix method to better understand how it works
15:21 shaal joined
15:21 hazmat__ joined
15:21 <johnw> lyxia: in Coq that is entirely true. Terminating functions must destruct their argument down to a base case (proven by a well-founded relation), and Productive functions must always construct new layers around subsequent calls (I'm not sure if a means exists, though, to prove this by a relation that represents a greatest fixed point)
15:22 <johnw> corecursion is certainly less mature than recursion
15:23 <johnw> (er, in Coq)
15:23 <johnw> I think if it were used more, it would have better support
15:23 doodlehaus joined
15:24 <lyxia> I see. Thanks!
15:26 <ertes> hmm, -XMultiWayIf doesn't work in arrow notation… great =/
15:26 <* ertes> resorts to the (case () of _ | …) hack
15:26 mohsen_ joined
15:27 Rotaerk_ joined
15:27 CoconutCrab joined
15:28 groscoe joined
15:28 FreeBirdLjj joined
15:29 bollu joined
15:30 takle joined
15:32 ragepandemic joined
15:32 mothe joined
15:33 Levex joined
15:33 <ertes> there has to be a nicer way to write this: https://gist.github.com/esoeylemez/5dffd42b4fee7f8591c8fddf778830c5
15:33 <ertes> (i have traversals with more than two cases, so the 'case' is just for demonstration purposes)
15:34 jinblack joined
15:35 <ertes> i thought of using ArrowMonad, but there is no obvious way to use it that would actually be nicer than this
15:36 janos joined
15:38 shayan_ joined
15:39 fDev2179 joined
15:39 xaviergmail joined
15:42 janos__ joined
15:42 cdg joined
15:42 mda1 joined
15:42 takle joined
15:45 cmdd joined
15:46 dramforever joined
15:46 roconnor joined
15:46 <bollu> isn't the non-commutativity of monad transformers a huge pain?
15:46 <johnw> bollu: you mean, in general?
15:46 <bollu> yes
15:47 <johnw> bollu: some are commutative (like ReaderT, with any monad)
15:47 <johnw> no, no particular pain
15:47 <bollu> I see
15:47 <Rembane> It's less than you might think. :)
15:47 sysop joined
15:47 dramforever left
15:47 dramforever joined
15:47 caumeslasal joined
15:47 hazmat__ joined
15:47 dramforever left
15:47 dramforever joined
15:48 <bollu> johnw: I've been using State + Error, which don't commute. I was wondering what would happen if I start adding things like Cont
15:48 <bollu> johnw: reasoning seems hard
15:48 dramforever left
15:48 jetho joined
15:48 <johnw> State + Error just has outright different semantics than Error + State. It's a feature that you can chose the meaning that is most appropriate.
15:48 gcross joined
15:48 Rotaerk joined
15:48 ilja_kuklic joined
15:49 <bollu> johnw: isn't that what "don't commute" means? :) semantics don't match if you flip them?
15:49 <johnw> ContT is a bit of a special beast; it introduces a couple restrictions that most other transformers don't have
15:49 <bollu> johnw: hm, I see. I have been told that ListT is also hard to "get right?
15:49 <Tuplanolla> How pleasant are noncommutative monads to use in mtl style?
15:49 <bollu> "*
15:49 <johnw> bollu: well, in that case, commutativity would mean eliminating information
15:49 <bollu> johnw: yeah
15:49 <Tuplanolla> I've never tried that.
15:49 <johnw> ListT isn't all that hard to get right, it's just that the naive version isn't right at all
15:49 <bollu> johnw: is there some way to systematically derive like, the, "commutator" of two monads?
15:50 <johnw> bollu: no
15:50 <bollu> johnw: like, in the group theory sense of the word, I can abelianise a group by finding the commutator subgroup, right?
15:50 skeuomorf joined
15:50 <bollu> oh, that's sad
15:50 bob3434 joined
15:51 <cocreature> Tuplanolla: it’s a bit weird since your semantics now change depending on how you instantiate the type class constraints
15:51 lars_ joined
15:51 zeroed joined
15:51 zeroed joined
15:51 <bollu> if I have a StateT s Either e a, and I have a "Left e", how do I raise it into the StateT? "lift" doesn't seem to be doing the trick
15:51 Guest49547 left
15:51 <johnw> make a combinator called "left"
15:52 <bollu> do I get it by default with mtl?
15:52 <Tuplanolla> I can imagine, cocreature. It feels like pushing an unnecessary choice to the user.
15:52 <johnw> left e = StateT $ \_ -> Left e
15:52 <johnw> bollu: I don't think so
15:52 owiecc joined
15:52 <johnw> mtl doesn't really give you combinators specific to certain combinations
15:52 <bollu> hm, OK, thanks :)
15:53 fizruk joined
15:53 <cocreature> wait why does lift not work?
15:53 <johnw> yeah, I'm wondering that now too
15:53 <cocreature> :t lift :: Either e a -> StateT s (Either e) a
15:53 <lambdabot> Either e a -> StateT s (Either e) a
15:53 <cocreature> works just fine
15:54 xubunto joined
15:54 <Tuplanolla> One other thing that bugs me is using `bracket` and friends with mtl style.
15:54 <xubunto> how would I get a file with <$> and <*> to compile?
15:54 <Tuplanolla> You have to choose an order for that.
15:55 <cocreature> xubunto: I don’t understand that question. do you have some specific error?
15:55 <xubunto> cocreature: not in scope
15:55 <cocreature> xubunto: import Control.Applicative
15:55 <cocreature> or use a newer ghc, 8.0 should have them in the Prelude iirc
15:55 <Tuplanolla> Even 7.10 does, cocreature.
15:56 <bollu> johnw: well fuck, turns out I wanted ExceptT e State s a
15:56 <johnw> bollu: haha
15:56 <cocreature> Tuplanolla: ah nice, I wasn’t sure when that was introduced
15:56 <bollu> johnw: I misinterpreted the way they compose :P
15:56 shaal joined
15:56 <johnw> bollu: don't worry, that happens to all of us
15:56 drostie joined
15:56 <Tuplanolla> I'm still stuck in 7-land here.
15:56 Levex joined
15:56 <johnw> the composition is somewhat the inverse of the execution
15:56 <bollu> yeah
15:56 <bollu> just noticed xD
15:56 <johnw> ExceptT on the "outside" means that it's the most immediate effect
15:56 <cocreature> bollu: in that case the function you’re looking for is called "hoistEither"
15:57 <bollu> cocreature: I see, thank you
15:57 <cocreature> it’s in the errors package iirc
15:57 sdothum joined
15:57 <bollu> cocreature: interestingly enough, this is the first time I have decided to use lens in a full blown fashing
15:57 <bollu> cocreature: it's fun, seeing how a "throw everything together" sort of codebase works out
15:57 <bollu> everything = mtl + lens + other stuff
15:57 <johnw> bollu: are you in the SF bay area by any chance?
15:58 <bollu> johnw: naw, India :) undergrad
15:58 <xubunto> cocreature: tyvm
15:58 <johnw> I'm going to be giving a talk on "pratical lensing" at BayHac
15:58 <bollu> johnw: why?
15:58 <bollu> ooh, that is quite cool
15:58 <johnw> like, a totally non-theory, "this is how we use lenses to get stuff done at my job" type of presentation
15:58 <johnw> since we use lenses in everything we do
15:58 <cocreature> bollu: oh btw you mentioned that you’re coming to zurich right? will you be at zurihac?
15:58 <bollu> johnw: I have actually been trying to understand the theory. I dislike treating haskell libraries as libraries, they usually have some super pretty theory
15:58 <Tuplanolla> Does it involve `RankNTypes`, johnw?
15:59 <bollu> cocreature: I am considering it. I will have to ask my professor!
15:59 <bollu> cocreature: I'll be at ETH, so I'm not sure how far away it is
15:59 <johnw> Tuplanolla: at most I'm going to mention ALens as a way to avoid that requirement
15:59 <bollu> johnw: will there be a video recording? I would love to watch it
15:59 <bollu> johnw: of the talk that is
15:59 <johnw> Tuplanolla: however, my upcoming talk on in the south bay on quantification will cover RankNTypes in detail
15:59 <johnw> bollu: I think so
16:00 epsilonhalbe left
16:00 <Tuplanolla> To me that extension is a sign that I'm lensing too hard and need to stop, johnw.
16:00 <johnw> haha
16:00 <bollu> cocreature: I am registering, what the hell, might as well :)
16:00 <bollu> cocreature: will you be there?
16:00 <johnw> I don't often treat lenses as values in my work use of lens
16:00 <cocreature> bollu: looking forward to meeting you there!
16:00 <johnw> sometimes, but not often
16:01 buglebudabey joined
16:01 <bollu> cocreature: you too :D
16:01 pantsman_ joined
16:02 mada joined
16:03 pleax joined
16:03 <ertes> Tuplanolla: uhh… why?
16:03 skeuomorf joined
16:03 takle joined
16:03 <ertes> RankNTypes is mostly a convenience feature with lenses
16:04 <Tuplanolla> It means I'm spending more times making functions from lenses to lenses than doing useful things, ertes.
16:04 alx741 joined
16:04 <ertes> ah =)
16:04 <ertes> you don't need RankNTypes for that though
16:05 <johnw> wouldn't he if the function were Lens' s a -> Lens' t b?
16:05 <ertes> if you change the type signature of your function, it may become more efficient, and you may get rid of that indicator, so you can keep lensing happily =)
16:06 defaultnick_ joined
16:06 <ertes> johnw: i think most of the time you can work with LensLike and not use RankNTypes
16:06 <ertes> at least for the use cases that come to my mind
16:07 <cocreature> johnw: I don’t think you can avoid enabling RankNTypes by the use of a type synonym or can you?
16:07 atz__ joined
16:07 <johnw> cocreature: well, you could use LensLike, or unfold the type aliases and share the constraint
16:07 FreeBirdLjj joined
16:08 <Tuplanolla> What if you want to use an argument lens over more than one functor?
16:08 <johnw> i.e.,: foo :: forall f. Functor f => ((a -> f a) -> s -> f s) -> (b -> f b) -> t -> f t
16:09 <johnw> in fact, if you get used to writing lenses as plain functions, you can create them without even importing lens
16:09 conal joined
16:10 JuanMiguel joined
16:10 Big_G joined
16:10 <Tuplanolla> The lens equivalent of `\ p fs xs -> (p fs) (p xs)`.
16:10 fractalsea joined
16:11 fDev2179 left
16:12 markus1189 joined
16:12 markus1199 joined
16:14 arj joined
16:18 andrei_chiffa_ joined
16:18 fractalsea joined
16:20 WizJin joined
16:20 mkoenig joined
16:20 wahrsagevogel joined
16:20 Qfwfq joined
16:20 jgertm joined
16:21 buglebudabey joined
16:24 andrei_chiffa__ joined
16:28 mizu_no_oto joined
16:29 coot joined
16:29 srbaker_ joined
16:33 MrcRjs joined
16:36 insitu joined
16:36 janos joined
16:36 fredmorcos joined
16:38 djellemah joined
16:38 ner0x652 joined
16:38 Levex joined
16:39 defaultnick_ joined
16:40 rcat joined
16:40 jdnavarro joined
16:40 Ch3ck joined
16:41 cschneid_ joined
16:41 andrei_chiffa_ joined
16:42 supersixone joined
16:43 janos joined
16:44 kolko joined
16:45 tel joined
16:47 spaceghost[m] joined
16:50 hamid joined
16:50 [scrooge] joined
16:51 roconnor joined
16:52 ramzifu joined
16:52 simendsjo joined
16:53 lingeeal joined
16:54 lingeeal joined
16:54 hazmat_ joined
16:54 <nshepperd_> Tuplanolla: ALens / cloneLens i guess
16:55 <Tuplanolla> Not in Microlens unfortunately.
16:56 fizruk joined
16:57 marfoldi joined
16:57 zeroed joined
16:57 zeroed joined
16:58 jmcarthur joined
16:58 mthek joined
16:58 watabou joined
16:58 <* hexagoxel> replaces `mp >>= x -> go $ (g -> g $ f x) <$> rest` with `go rest >>= g -> g . f <$> mp`, and has spent way too much time on that change.
16:59 <hexagoxel> encoding functions of arbitrary arity in a free applicative requires strangely reversed order of effects..
16:59 lak joined
16:59 lingeeal joined
17:00 <spaceghost[m]> No uses el nombre de nagorno-karabakh en vano clint.
17:00 <johnw> ... go $ ($ f) <$> mp <*> rest ...?
17:00 James joined
17:00 <johnw> no, (($) . f)
17:01 <johnw> haha, future readers will hate you either way
17:01 <hexagoxel> exactly :D
17:01 bollu1 joined
17:01 <johnw> do x <- mp; g <- rest; go (g (f x))
17:02 <hexagoxel> you are optimizing the replaced variant btw.
17:02 <hexagoxel> do g <- go rest; p <- mp; return (g (f p))
17:03 lingeeal joined
17:03 pleax joined
17:04 <johnw> yeah, I'd rather read that
17:05 <johnw> of course, if we had idris we could so: return $ !(go rest) (f !p)
17:05 <johnw> s/so/say
17:05 <hexagoxel> if you have a rough idea what the function is supposed to do, do-vs-pointfree does not change too much. If you don't, then either won't make sense.
17:05 jespada joined
17:05 <johnw> err, f $mp
17:05 <johnw> f !mp
17:06 defaultnick_ joined
17:06 owiecc joined
17:07 patbecich joined
17:07 tsahyt joined
17:07 urodna joined
17:07 <lpaste_> hexagoxel pasted “context, just for fun” at http://lpaste.net/353240
17:07 buglebudabey joined
17:07 govg joined
17:08 <hexagoxel> "<- eqT ->" is such a tease, visually.
17:09 <Gurkenglas> hexagoxel, why isnt the "step f rest $" in line 4 instead?
17:09 <johnw> why lambdacase and not just two definitions? It would be the same exact size
17:09 nomotif joined
17:10 <hexagoxel> more importantly, i think i can use runAp.
17:10 <bollu1> if I have a lens into a small part of my state, how do I set it inside a State monad?
17:10 <Gurkenglas> The whole thing looks like just a monadic catamorphism, um, I think the thing that defines free monads?
17:10 <tsahyt> I've been puzzling over this for a while now. Given an (r -> (b,d)) -> (r -> (c,d)), I'd like to construct an (r -> b, d) -> (r -> c, d). Is this even at all possible?
17:11 <Gurkenglas> :exf ((r -> (b,d)) -> (r -> (c,d))) -> ((r -> b, d) -> (r -> c, d))
17:11 <tsahyt> the use case here is that I'm trying to write an ArrowLoop instance for something. I've got one version that type checks, but doesn't work in practice, and since my arrows underneath are just specialized functions, I thought I could reuse the instance for (->) somehow
17:11 reuben364 joined
17:11 JeanCarloMachado joined
17:12 exferenceBot joined
17:12 raycoll joined
17:12 <tsahyt> @djinn ((r -> (b,d)) -> (r -> (c,d)) -> ((r -> b, d) -> (r -> c, d))
17:12 <lambdabot> Cannot parse command
17:13 <hexagoxel> @djinn ((r -> (b,d)) -> (r -> (c,d))) -> ((r -> b, d) -> (r -> c, d))
17:13 <lambdabot> f a (b, c) =
17:13 <lambdabot> (\ d ->
17:13 <lambdabot> case a (\ _ -> (b d, c)) d of
17:13 <lambdabot> (e, _) -> e,
17:13 <lambdabot> c)
17:13 eklavya joined
17:13 <tsahyt> that went quick
17:13 eklavya joined
17:13 <Gurkenglas> *looks on hackage* oh yes runAp, lets race to who gets that implemented :D
17:14 <tsahyt> runAp?
17:15 <* hexagoxel> gets doubts that runAp would work
17:16 <tsahyt> @hoogle runAp
17:16 <lambdabot> Control.Applicative.Free runAp :: Applicative g => (forall x . f x -> g x) -> Ap f a -> g a
17:16 <lambdabot> Control.Applicative.Free.Final runAp :: Applicative g => (forall x . f x -> g x) -> Ap f a -> g a
17:16 <lambdabot> Control.Applicative.Trans.Free runAp :: Applicative g => (forall x . f x -> g x) -> Ap f a -> g a
17:17 lak joined
17:17 <tsahyt> is there an offline version of djinn somewhere? I think it could be useful to bind this into vim
17:18 lingeeal joined
17:18 <hexagoxel> Gurkenglas: i think i make use of the fact that output is a free monad.
17:18 <bollu> how do you deal with State / StateT *without* lens?
17:18 <hexagoxel> @hackage djinn
17:18 <lambdabot> http://hackage.haskell.org/package/djinn
17:18 <bollu> isn't it a pain to set particular fields?
17:18 <bollu> I've just started using "lens", and it seems super neat
17:19 <tsahyt> thanks
17:20 comingsoon2 joined
17:20 buglebudabey joined
17:21 g-k--1-w-m--s-u- joined
17:21 bollu1 joined
17:22 Fendor joined
17:22 variable joined
17:22 <zennist> quick question: does 'cabal sandbox' uses ghci in its building phase?
17:22 <hexagoxel> no
17:22 <hexagoxel> it uses ghc.
17:22 <zennist> I'm getting build errors which look like ghc is trying to load code into ghci - however there is no *TemplateHaskell* enabled or used in my code
17:23 g-k--1-w-m--s-u- joined
17:24 conal joined
17:24 <slack1256> anybody know other blogpost of detecting space leaks at writing time like the ones from ezyang?
17:25 <johnw> you've read Neil's right?
17:25 <slack1256> yep, his trick is the best I know for detecting leaks at runtime
17:25 dreco joined
17:26 <slack1256> yet my confidence falters that I don't have a good model for writing time
17:26 <johnw> oh, writing time
17:27 <Gurkenglas> (Oh hey hexagoxel uses f for step so it's a little more tangled but I guess I'll try extracting the recursion scheme)
17:27 buglebudabey joined
17:27 <slack1256> (I got this app that has a event loop for network events, runtime testing requires mocking stuff and I want to avoid it)
17:27 takle joined
17:27 g-k--1-w-m--s-u- joined
17:28 takle joined
17:28 xaviergmail joined
17:29 g-k--1-w-m--s-u- joined
17:30 rekahsoft joined
17:30 g-k--1-w-m--s-u- joined
17:30 contiver_ joined
17:30 g-k--1-w-m--s-u- left
17:30 g-k--1-w-m--s-u- joined
17:30 bollu joined
17:30 <johnw> it's hard to always know, but things to look out for: (1) calling other functions within a "case", (2) thunks whose result is much smaller than the data they're computed from, (3) creating structures whose spine is strict, but whose contents are not, (4) using tuples too much (very typical way of causing thunks to occur in places where they might not otherwise, as a special case of #3), (5) recursion from within a lambda, (6) expecting
17:30 <johnw> State s to be strict in 's', ...
17:31 fronk joined
17:32 caumeslasal joined
17:32 roconnor joined
17:33 patbecich joined
17:35 buglebudabey joined
17:35 srbaker_ joined
17:36 dogweather joined
17:36 <slack1256> I've been thinking the relationship between the call and the called lately. A big problem is that how memory depends in the intereaction between the two, the cost model is not local
17:36 <slack1256> but we can make this simpler if we restrict the functions allowed to `call`
17:37 <slack1256> this would be like okasaki analysis of queue being restricted to certain functions
17:37 <slack1256> yet I don't know if this is naive
17:37 takle_ joined
17:39 JeanCarloMachado joined
17:40 josh5tone joined
17:40 <ph88> maybe stupid question but when i have list in the form of tuples of 2, so (elem1, (elem2, ()) then how do i find the last occurance of a value ?
17:41 <johnw> ph88: You'd need to encode this pattern as a data type, so that you can make use of type recursion, and then write a recursive function
17:41 <slack1256> ph88: actually that is a great idea, that exactly is what the Free ADT does
17:41 takle joined
17:41 <johnw> well, and lists
17:42 <johnw> since what he wrote is the same as Free ((,) a) () ~ [a]
17:42 <ph88> johnw, it's already a data type .. but i need 2 functions then one for searching and one for the thing i really want ?
17:42 defaultnick_ joined
17:42 <johnw> ph88: I don't understand
17:42 epsilonhalbe joined
17:43 <ph88> johnw, well let's say i have (1, (3, (2, 0))) and i want to change the highest number to 10
17:43 <johnw> why do you want to encode a list like this?
17:43 <ph88> this is about GHC.Generics
17:43 <ph88> :*:
17:44 saylu joined
17:44 <ph88> so maybe one function that traverse over the list and gives me the index of the highest number, and then another function to traverse again and give back the same list with the number at the index changed to 10 ?
17:45 <ph88> i don't have any better ideas
17:46 <johnw> I don't understand why these two steps need to be separated
17:46 <johnw> I feel like I don't have the full picture
17:46 sepp2k joined
17:46 <ph88> what else can i tell you ?
17:47 edvorg joined
17:47 jsgrant joined
17:48 JeanCarloMachado joined
17:50 <lpaste_> glguy pasted “starting point for ph88” at http://lpaste.net/353242
17:50 <ph88> nice module name
17:50 <glguy> You can use that same class to update by value or index
17:51 <ph88> oh lens ^^
17:51 <johnw> glguy is also allowing a arbitrary tree structure,
17:51 <johnw> so (((1, 3), 2), 0) would be allowed too
17:52 <ph88> ye
17:52 <ph88> but what about changing the value of the highest to 10 ?
17:53 <glguy> *Ph88> itoListOf (indexing ints) (1::Int,(3::Int,(2::Int,0::Int)))
17:53 <glguy> [(0,1),(1,3),(2,2),(3,0)]
17:53 sunjay joined
17:53 ertesx joined
17:54 <glguy> *Ph88> set (elementOf (indexing ints) 2) 20 (1::Int,(3::Int,(2::Int,0::Int)))
17:54 <glguy> (1,(3,(20,0)))
17:54 <glguy> You can build stuff like that
17:54 <ph88> set, is that lens ?
17:54 <glguy> yeah
17:54 Kreest joined
17:54 osa1 joined
17:54 <ph88> maybe best to do it without lens ?
17:55 <glguy> It's not really worth doing in general
17:55 <glguy> but if you're going to do it, let's not make it harder than we need to :)
17:55 <ph88> what do you mean it's not worth doing ?
17:56 JeanCarloMachado joined
17:57 <glguy> Working with trees of tuples instead of a more appropriate type for the operations at hand?
17:58 <* ski> . o O ( `data List a t = Here t | Add (List a (a,t))' )
17:58 <monochrom> I think dependent type fans would be thrilled. A tree type that tells you the value's tree shape, like a vector type that tells you the value's length (which is vector shape).
17:58 <ph88> ooh that
18:00 <* ski> . o O ( `data Tree a k = Leaf (k a) | Branch (Tree a (t0 -> Tree a (t1 -> k (t0,t1))))' )
18:00 dabd joined
18:03 <ph88> glguy, why did you made a typeclass for it ?
18:03 <ph88> oh i think i know why actually ^^
18:04 pleax joined
18:04 janos joined
18:05 doodlehaus joined
18:06 watabou joined
18:06 gugah joined
18:07 gugah joined
18:12 weatherforecaste joined
18:12 lavalike joined
18:13 Levex joined
18:14 <ph88> does someone know a function like Control.Lens.Fold.findOf that returns the rightmost element that matches the predicate ?
18:14 coltfred joined
18:14 path[l] joined
18:15 doodlehaus joined
18:16 buglebudabey joined
18:16 variable joined
18:17 Big_G joined
18:18 afarmer joined
18:18 doodlehaus joined
18:19 bollu joined
18:19 <zennist> i finally figured out why ghc is using ghci on compile phase when i'm not using template haskell - i have some ANN annotations....
18:19 <Gurkenglas> ph88, lastOf combined with filtered?
18:19 doodlehaus joined
18:20 <ph88> i'll try it Gurkenglas
18:21 drbojingle_ joined
18:21 hyuke joined
18:21 soLucien joined
18:22 lithie joined
18:22 tommd joined
18:22 <ertes> is there a way with 'zoom' to access the current index of an indexed traversal?
18:22 mda1 joined
18:23 GBrawl joined
18:25 sevensor joined
18:26 <ph88> Gurkenglas, can i use filtered as is or do i need to combine it with a function to do the traversal ?
18:26 <Gurkenglas> :t filtered
18:26 <lambdabot> (Choice p, Applicative f) => (a -> Bool) -> Optic' p f a a
18:26 <ph88> hmz
18:27 <Gurkenglas> That specializes to (a -> Bool) -> Fold' a a.
18:28 albertus1 joined
18:29 <ph88> i don't know where to call that function
18:29 Guest4561 joined
18:29 Guest4561 left
18:29 <ph88> i have now lastOf ints (1::Int,(3::Int,(2::Int,0::Int))) Just 0
18:29 <ph88> this seems to work
18:30 <ph88> but lastOf does not take an argument that matches the type of filtered
18:30 <glguy> lastOf (ints . filtered odd)
18:30 <ph88> lastOf (ints . filtered (\x -> x == 3)) (1::Int,(3::Int,(2::Int,0::Int)))
18:30 <ph88> oh ye nice
18:31 defaultnick joined
18:33 <glguy> filtered (==3) is only 3
18:34 <glguy> err, no, I think I'm wrong there
18:35 saurabhnanda joined
18:35 <glguy> It's similar: *Ph88> lengthOf (ints . only 3) (1::Int,(3::Int,(2::Int,0::Int)))
18:35 <glguy> 1
18:35 <ph88> how can i not just get the last element but get the entire structure back with the last element that matches the predicate ?
18:35 <saurabhnanda> Is it possible to have a "functional dependency" of sorts between type-variables in a function signature, eg runQuery :: (haskells -> columns) => Connection -> Query columns -> IO [haskells]
18:36 coltfred joined
18:36 <ph88> i mean i want to modify the last element that matches the predicate, but get the entire structure back with that one element modified
18:38 chaosmasttter joined
18:40 zeroed joined
18:40 buglebudabey joined
18:41 <ertes> saurabhnanda: how would that be resolved?
18:41 <ertes> saurabhnanda: you could use a type family, of course
18:42 <saurabhnanda> ertes: I'm not actually sure. I'm trying to say if `haskells` is inferred by the compiler (based on usage), then there should be only one type of `columns` that the compiler can infer.
18:42 <bollu> saurabhnanda: can you not use an actual functional dependency?
18:42 <ertes> saurabhnanda: the compiler still needs to actually infer it
18:42 <saurabhnanda> ertes: and btw, haskells & columns can very well be record types.
18:42 <ertes> saurabhnanda: so you need an explicit function, e.g. a type family
18:42 <saurabhnanda> bollu: functional dependencies are only on type-classes, right?
18:43 <lyxia> saurabhnanda: you can define a type synonym
18:43 <ertes> type family Columns haskells
18:43 <lyxia> that ^
18:43 <glguy> ph88: You can use 'holesOf' to get a view of an element in the structure and a way to put it back
18:43 <Athas> Grrr, I disagree with hlint that '&&' is better than 'and'.
18:44 <ertes> runQuery :: Connection -> Query (Columns haskells) -> IO [haskells]
18:44 <saurabhnanda> is the other way around easier? columns -> haskells?
18:44 <ertes> saurabhnanda: like that
18:44 AndreasK joined
18:44 <Athas> Whatever. The computer gets its way!
18:44 <bollu> ertes: can you force a type family to be injective?
18:44 <ertes> bollu: yes, since… uh… was it 7.10 or 8.0?
18:45 <ertes> in any case you can use -XTypeFamilyDependencies
18:45 <bollu> ertes: I see, cool
18:45 <ph88> glguy, documentation mentions peek at what the structure would be like with an edited result
18:45 <saurabhnanda> ertes: interesting. Can you write a type-family such that you "map" a -> b, c -> d, and then (a, c) -> (b, d) happens automagically?
18:45 <ph88> peek has no documentation only type signature peek :: s -> w a -> a
18:45 <saurabhnanda> what is an injective type family?
18:46 <ertes> saurabhnanda: not sure what you mean… a type synonym family is pretty much a type function, but with some restrictions
18:46 _sg joined
18:46 <cocreature> saurabhnanda: injective means that there are no two inputs which map to the same outputs
18:46 <ph88> how can i use holesOf to first search an element in a structure, then view it, modify it, and then put it back ?
18:46 <glguy> ph88: if you don't understand the types you can just try out the two argument ordering s
18:46 Trenif joined
18:46 Einwq joined
18:46 <glguy> ph88, you can 'extract' to see the current value
18:46 <ertes> saurabhnanda: injectivity lets the compiler decide the argument from the result… think of fundeps in both directions
18:47 <saurabhnanda> ertes: Columns PGInt4 = Int64; Columns PGText = Text; and then this happens automagically ==> Columns (PGInt4, PGText) = (Int64, Text)
18:47 <ph88> how can i search when i can only see the current value ?
18:47 hucksy joined
18:47 <ph88> this stuff is totally new to me :|
18:48 sablib joined
18:48 <ertes> saurabhnanda: type instance Columns (a, b) = (Columns a, Columns b)
18:48 <johnw> > [1,2,3,4] & traverse.filtered (==3) .~ 5
18:48 <glguy> just play with it a bit in ghci
18:48 <lambdabot> [1,2,5,4]
18:48 <johnw> > [1,2,3,4] & _last .~ 5
18:48 <saurabhnanda> ertes: but do I need to define that manually
18:48 <lambdabot> [1,2,3,5]
18:48 <ertes> saurabhnanda: yes, of course
18:48 <saurabhnanda> ertes: because that would not scale for the problem I have in mind
18:48 <glguy> or figure out what it is you don't understand specifically and I'll try to answer
18:48 <ertes> saurabhnanda: tuples don't scale in general
18:49 <saurabhnanda> ertes: scale != performance scaling.
18:49 Dagnabit joined
18:49 <ertes> saurabhnanda: but 2-tuples can be nested arbitrarily
18:49 jetho joined
18:50 technician1138_ joined
18:50 <bollu> saurabhnanda: you can define the instances the way ertes showed for n-tuples as well
18:50 baamonde joined
18:50 <bollu> saurabhnanda: though I'm not sure I interpreted your question right
18:50 <ertes> Columns ((a, b), (c, d)) = (Columns (a, b), Columns (c, d)) = ((Columns a, Columns b), (Columns c, Columns d))
18:51 <saurabhnanda> I"m trying to come up with a solution where I define the mappings between PG types and Haskell types in one place, and then I can combine them in any record or tuple type without having to write boilerplate for that specific record or tuple type.
18:51 dfeuer joined
18:51 janos joined
18:51 <saurabhnanda> or the standard answer to that is any other API related to tuples, right?
18:51 <ertes> saurabhnanda: i don't know why you need a type *mapping* there, but regardless, generics might solve your problem
18:51 Cassiopaya joined
18:51 <saurabhnanda> write shitloads of them up to 64 tuples?
18:52 pasukon joined
18:52 <bollu> saurabhnanda: why are you getting those many tuples in the first place?
18:52 conal joined
18:52 <saurabhnanda> Column (a, b) = (Column a, Column b)
18:52 <saurabhnanda> Column (a, b, c) = (Column a, Column b, Column c)
18:52 <saurabhnanda> and so on... till 64
18:52 Levex joined
18:52 <saurabhnanda> bollu: SQL queries
18:52 ramzifu joined
18:52 <ertes> saurabhnanda: why do you get those tuples?
18:52 <bollu> saurabhnanda: you can use some template haskell
18:52 <cocreature> sounds like you want to generate instances using generics
18:53 <bollu> cocreature: GHC.Generic?
18:53 <saurabhnanda> Full context = I'm trying to simplify Opaleye :)
18:53 <ertes> yes, if anything, generics is probably the best answer, but a better answer is not to create those tuples in the first place
18:53 <bollu> saurabhnanda: ohh, right, you had asked about profunctor in Opaleye the other day right?
18:53 <saurabhnanda> tomjaguarpaw: is around here?
18:53 <cocreature> bollu: or generics-sop or one of the other generics libraries
18:53 <saurabhnanda> bollu: yep!
18:54 <cocreature> but you can’t magically make up instances without defining them somehow
18:54 <saurabhnanda> so, I guess "scaling" the type-families to tuples is simple. Define them for 64 tuples in the core library and be done with it. Profunctors have also done that. Every single library that deals with tuples does that.
18:54 <saurabhnanda> but with record-types it's a different problem.
18:54 <bollu> saurabhnanda: tangential question: do you always get the results of SQL queries as tuples? can you not get them as a record type or something
18:55 <saurabhnanda> which is where we are stuck with a bit of TH.
18:55 <saurabhnanda> bollu: getting them with record types makes the problem even harder, no?
18:55 <bollu> saurabhnanda: you can write a function that does (a -> b -> c -> d) to (PGtype a) -> (PGType b) -> (PGType c) -> (PGType d) by using the "printf" trick I think
18:55 <davean> bollu: That generally requires template haskell or a wrapper
18:56 <bollu> davean: ah
18:56 <bollu> davean: I assumed the "printf" style trick + type families could work.
18:56 <davean> bollu: the problem is you don't "know" what the query is returning persay
18:56 <ph88> glguy, maybe there is a tutorial somewhere to get started? i never worked with lens before
18:56 <ph88> i saw a video about get and set though
18:56 <bollu> davean: I'm not sure what you mean by that
18:56 <davean> bollu: you've got a miss-match problem where you don't have a typed return value from the DB
18:57 coot joined
18:57 <bollu> davean: but this is happening inside haskell right? where queries are haskell functions?
18:57 <davean> bollu: no, the problem is its external
18:57 <davean> so typing the return of a query is just hard
18:57 buglebudabey joined
18:57 <bollu> davean: ah, OK, I'm missing this bit of context
18:58 ramzifu joined
18:58 <davean> you're interacting with a remote API with very little guarrentee about what it'll hand you back
18:58 <davean> It tends to be consistent but underdefined
18:58 <davean> so, the TH approch is "lets look at the DB, assume it doesn't change, and generate code that matches what we see"
18:59 <davean> which of course breaks, rather hard, if something DOES change
18:59 <bollu> hm
18:59 <saurabhnanda> davean: so the problem is not at that step
18:59 hazmat_ joined
18:59 <saurabhnanda> davean: we've already assumed what the columns are; and what their types are
18:59 <davean> saurabhnanda: ah, I missed that
19:00 <thoughtpolice> davean: I have no idea what you mean. Opaleye already assumes the DB matches the schema; that is a completely independent problem. You are already relying on instance selection; the question is whether you can guide instance selection further so that it not only picks the right column results, but further gives you the right Haskell results.
19:00 <saurabhnanda> davean: now, after we've done composing all the complicated SQL queries dealing with (Column x) types; we want to convert them to Haskell types easily
19:00 <davean> thoughtpolice: I think I missed something
19:00 <thoughtpolice> I think. Either way I definitely think there's a way to do this in Opaleye, but I'm not sure what it would look like.
19:00 <saurabhnanda> which is where the idea of functional dependency between (columns -> haskells)
19:00 <thoughtpolice> davean: Yeah. (Relatedly, I actually _do_ want to combine Opaleye with a TH-level schema check, though...)
19:01 <saurabhnanda> thoughtpolice: we're working on that with opaleye-helpers
19:01 <thoughtpolice> saurabhnanda: Link?
19:01 <bollu> saurabhnanda: so, you also want to convert the "Column x" types to record types?
19:01 <saurabhnanda> thoughtpolice: taking a page out of the HRR handbook. Use TH to look at the schema and generate all the Opaleye boilerplate.
19:02 <benzrf> so this is closed, but i'm having this exact issue https://ghc.haskell.org/trac/ghc/ticket/12216
19:02 <saurabhnanda> thoughtpolice: https://github.com/vacationlabs/opaleye-helpers -- heavy WIP. Developing alongside a production app to make sure it fits real-world requirements.
19:02 <benzrf> am i just on an eight-month-old version of ghc...?
19:02 Unhammer joined
19:03 <saurabhnanda> but we still hate the fact that everything in Opaleye needs a type signature because of the way it's structured.
19:03 <thoughtpolice> benzrf: It was reported in 8.0.1, but there is no indication in the ticket it was merged to the stable branch. It is probably not in 8.0.2, if that's what you're using.
19:03 <davean> benzrf: what version are you on?
19:03 <saurabhnanda> From https://www.stackage.org/haddock/lts-7.14/opaleye- -- runQuery's use of the Default typeclass means that the compiler will have trouble inferring types. It is strongly recommended that you provide full type signatures when using runQuery.
19:03 <benzrf> oh
19:03 <benzrf> oh damn i'm still on 8.0.1... that's very strange
19:03 <benzrf> did .2 only come out recently?
19:04 <davean> benzrf: Jan
19:04 <thoughtpolice> Yes, a few weeks ago.
19:04 <benzrf> aha
19:04 <thoughtpolice> Or, yes.
19:04 <benzrf> oops!
19:04 <davean> Jan 11th to be specific
19:04 <maerwald> you're so retro :p
19:04 <* benzrf> updates his nix expressions
19:04 tommd joined
19:04 <ph88> if holesOf returns a list of the structure, what is the dual function that creates a structure back from the list ?
19:04 <bollu> saurabhnanda: where are the record types here?
19:05 <thoughtpolice> benzrf: No, it actually looks like it was fixed in the 8.0.x branch. So if you update, you should be OK.
19:05 fizruk joined
19:05 <benzrf> cool!
19:05 pleax joined
19:05 <thoughtpolice> The ticket just got lost in the ether, I suppose.
19:05 bamartindev joined
19:06 <saurabhnanda> thoughtpolice: https://github.com/vacationlabs/opaleye-helpers/pull/1/files#diff-04c6e90faac2675aa89e2176d2eec7d8 -- check the README here
19:06 <saurabhnanda> bollu: so the `haskells` type can be a record if you want. But that forces you to define these weird typeclass instances
19:07 <tsahyt> after many more hours of trying I'm starting to think that this thing doesn't have a valid ArrowLoop instance
19:07 <thoughtpolice> saurabhnanda: Thanks! I'm was hoping someone was already going down this path. (I don't really use or write TH very often)
19:07 <tsahyt> I now have two that typecheck
19:07 <bollu> saurabhnanda: I see
19:07 <tsahyt> but don't seem to ever terminate even for a simple example
19:07 <tsahyt> ertes: are you around?
19:07 jophish_ joined
19:09 <ertes> tsahyt: pong
19:09 systemfault joined
19:10 connrs joined
19:10 lspitzner joined
19:10 TxmszLou joined
19:10 spaceghost[m] left
19:10 <tsahyt> ertes: I've been tearing my hair out over implementing an ArrowLoop instance, and since you've written at least two libraries with arrow interfaces I thought you might know more. I've got a Wave a type which is the same as Word64 -> a. On top of that I have a newtype for Wave a -> Wave b. Since waves are a functor, its image forms a category, the arrows of which I want to model. But I can't figure out how to
19:11 <tsahyt> implement loop without it just recursing endlessly
19:11 <tsahyt> the reason why I want an arrow interface here is because it's the closest to the dataflow diagrams that are ubiquitous in DSP literature, so I'd just like to try how far that takes me
19:12 <tsahyt> I was thinking that since those are just functions, it should be pretty straight-forward to just adopt the ArrowLoop instance from (->) but that turned out not to work either
19:13 xaviergmail joined
19:14 <tsahyt> so I guess my question is really whether you can give me some pointers as to how this would work, or whether it can work at all
19:15 AndreasK joined
19:16 <ertes> tsahyt: paste?
19:18 <ertes> tsahyt: BTW, your reasoning as to why you want an arrow interface is misguided
19:19 lak joined
19:19 <tsahyt> hmm, lpaste is being slow. hold on
19:19 <ertes> the arrow interface is objectively inferiour to the monadic interface… it's not something you'd want, but rather something you can't do without in some cases
19:19 <ertes> *inferior
19:19 doomlord joined
19:20 <tsahyt> http://sprunge.us/edZg?hs
19:20 weatherforecaste joined
19:20 Levex joined
19:20 <tsahyt> nevermind the second type parameter to Wave in the WaveA definition. I was sloppy removing the irrelevant part
19:20 <tsahyt> (Waves are also parameterized over a sample rate parameter)
19:21 <ertes> tsahyt: how about (type WaveA r a b = Wave r a -> Wave r b)?
19:21 pasukon joined
19:22 <ertes> and: type Wave = (->)
19:22 <tsahyt> I've thought about that, but then I always get the wave as a whole when using <- in arrow notation I think?
19:22 <tsahyt> and about the type synonym for wave, I'd really rather not do that. I've got many things depending on the first parameter being words
19:22 <ertes> you don't use arrow notation… you use 'let'
19:22 <ertes> well
19:22 <ertes> type Wave = (->) Word64
19:23 <tsahyt> yes, but then I lose the type parameter, which is quite crucial at other points
19:23 <ertes> well, then… type Wave = (->)
19:23 <ertes> =)
19:23 <tsahyt> no I mean the r
19:23 <ertes> yes
19:23 <ertes> oh, r is really just phantom?
19:23 AndreasPK joined
19:23 <tsahyt> yes, newtype Wave (r :: Nat) a = ...
19:24 <tsahyt> I must make sure not to mix waves of different sample rates
19:24 JeanCarloMachado joined
19:24 mdarse joined
19:24 bennofs joined
19:24 <ertes> i see… at least i'd replace WaveA by simply using (->)
19:26 <tsahyt> I've thought about that. It'd at least save me from some worries. but this whole thing also sparked my curiosity as to how a proper ArrowLoop instance for the existing type would look like.
19:26 <ertes> you're just forcing yourself to use a much noisier syntax and slower code
19:26 <tsahyt> why slower? newtypes should be free, shouldn't they?
19:27 mjs2600 joined
19:27 <ertes> ArrowLoop for functions is pretty straightforward, and you're basically just writing a version of that with some wrapping/unwrapping
19:27 <ertes> newtypes are free, but the arrow interface is not
19:27 mkoenig joined
19:27 <tsahyt> right I hadn't thought of that
19:28 <ertes> it requires explicit side channels most of the time, which means lots and lots of tuple building and pattern-matching
19:28 <ertes> that's why you have stuff like 'first' and (***)
19:28 <tsahyt> but all I've been trying to do was to adapt the ArrowLoop (->) instance to WaveA, which never terminated even for simple examples
19:29 <ertes> try to write this, if you're curious: loopFunc :: ((a, r) -> (b, r)) -> a -> b
19:29 chrissl joined
19:29 <tsahyt> I have, and that works
19:30 <* ski> . o O ( trace )
19:30 jetho joined
19:30 Dagnabit joined
19:32 <tsahyt> ertes: when specializing loop to Wave a -> Wave b, I get (Wave a, r) -> (Wave b, r) -> Wave a -> Wave b. but for WaveA the type is slightly different. After the newtype unwrapping it's (Wave (b,d) -> Wave (c,d)) -> Wave b -> Wave c
19:32 <benzrf> @djinn ((a, r) -> (b, r)) -> a -> b
19:32 <lambdabot> -- f cannot be realized.
19:33 <benzrf> i didn't think it could!
19:33 <benzrf> hmmmmm
19:33 <tsahyt> :t \f b -> let (c,d) = f (b,d) in c
19:33 <johnw> btw, that's awfully close to what ArrowLoop does
19:33 <lambdabot> ((t1, t2) -> (t, t2)) -> t1 -> t
19:33 <johnw> and tsahyt's defintion is awfully close to the instance for (->) :)
19:34 <tsahyt> johnw: iirc it's exactly the same
19:34 <tsahyt> up to naming anyhow
19:34 <benzrf> oh, cute
19:34 epsilonhalbe left
19:34 <johnw> tsahyt: oh nice, exactly exactly
19:34 <tsahyt> johnw: well I've been looking at it a lot today
19:34 <johnw> I still want to know what the ArrowLoop instance for free arrows should be
19:35 <tsahyt> well I still want to know what the instance should be for my type :/
19:35 <tsahyt> but I guess I'll just give up and use the type synonym instead
19:35 orbifx joined
19:35 <tsahyt> it should have just been some unwrapping, but oh well
19:35 <johnw> tsahyt: pastie
19:35 davezd joined
19:36 chaosmasttter joined
19:36 <tsahyt> http://sprunge.us/edZg?hs
19:36 <tsahyt> this is what I ended up with. it ends up producing infinite loops for examples that really should work
19:36 <tsahyt> interestingly enough, it does not even bring up CPU usage while it does so
19:37 <johnw> what you pasted has some hard errors in it
19:37 <tsahyt> johnw: in case you're wondering, there's an additional phantom parameter to Wave, which I forgot to remove in some places
19:37 <johnw> newtype WaveA a b = WaveA { process :: Wave r a -> Wave r b } ?
19:37 <tsahyt> yes, wait I'll add them back in
19:37 <johnw> that's ok, my mayfly attention span just died
19:37 AndreasK joined
19:38 <tsahyt> http://sprunge.us/bAhI?hs
19:39 rixile joined
19:39 jsgrant- joined
19:41 AndreasK joined
19:41 grayjoc joined
19:41 <ertes> > let (x, y) = undefined in ()
19:42 <lambdabot> ()
19:42 <ertes> tsahyt: as far as i see your 'loop' implementation is correct
19:42 <ertes> tsahyt: the only potential for error i see there is excess strictness, but i can't see any
19:43 FullyFunctional joined
19:44 <ertes> however, semantically speaking it may not exactly do what you think it does: given (loop f), at each point in time the input wave of 'f' is a wave that has as its second component the feedback value *at every point in time*
19:44 <ertes> the feedback value of that point in time that is
19:45 <ertes> that's what your fmap does: it takes a wave and attaches a *constant* second component
19:45 <ertes> but it's only constant in that particular point in time… in the next frame it will be a different constant that is attached to the whole wave
19:46 sgflt joined
19:47 <tsahyt> that's what I've been reading from the types, and it's been a major source of confusion. But I suppose it really isn't what I want.
19:47 taksuyu joined
19:47 <tsahyt> when using the type synonym instead, this changes as far as I can see
19:48 GBrawl joined
19:48 <ertes> IMO you shouldn't use the type synonym either
19:48 <ertes> just use functions
19:48 owiecc joined
19:51 lspitzner joined
19:51 anuxivm joined
19:51 sunjay joined
19:52 takle_ joined
19:53 mac10688 joined
19:53 <tsahyt> but that would be exactly the same semantically
19:54 <tsahyt> I'd just be giving a name to the most central thing in the library
19:54 <ertes> tsahyt: the main difference is that with WaveA's 'loop' you're using value recursion on *samples*, not *waves*
19:56 <ertes> which means: time becomes relevant, and you need to deal with waves *at each point in time*
19:56 <tsahyt> well now I'm confused again. this of course always gets used with a delay, which offsets a wave by 1 sample, providing a default value to fill the now empty start. when I want to determine the final value after some recursive transformation, I thought I'd want to recurse back over the samples
19:57 <ertes> you need to delay the WaveA, not the Wave… delaying the Wave is pointless, because the feedback value is constant over the whole wave
19:57 <tsahyt> that explains a lot
19:57 Goplat joined
19:57 zeroed joined
19:58 <tsahyt> how would I do that though? at this point I'm just asking to give me peace of mind.
19:59 <tsahyt> I've checked and there are no additional instances that I've defined on WaveA that don't exist on (->), so I guess I'll switch to that then
19:59 raynold joined
19:59 <ertes> ideally you wouldn't do it and just use value recursion normally, which means that you can delay the Wave: let w = f (delay w')
19:59 <ertes> whoops
20:00 <ertes> let w = f (delay w)
20:02 lak joined
20:02 FullyFunctional left
20:03 j2j joined
20:04 falafel joined
20:04 raycoll joined
20:06 pleax joined
20:06 nbro joined
20:06 <nbro> Hi
20:07 connrs joined
20:07 janos joined
20:07 hackebeilchen1 joined
20:08 mjs2600 joined
20:08 <nbro> I’ve a question. I have a main module where I had not specified the IO action main was not defined and ghc was complaining about this
20:08 <nbro> but file is not really going to be used as a standalone app
20:08 zcourts joined
20:08 <davean> nbro: then is it a library?
20:08 <davean> nbro: declare it as such
20:08 <nbro> so, in these cases, is there a conventional way to define IO main?
20:09 <mauke> what else are you going to use a main module for?
20:09 <davean> Either having an IO main makes sense or it doesn't
20:09 <nbro> well, the file name is lower case and it must remain like that (specifications)
20:09 <mauke> what
20:09 <davean> if its an executable it has an main, if its not it doesn't
20:09 <davean> the concept of an executable without a main is contradictory, without a main it can't be run
20:09 <nbro> I’m not saying that
20:10 <nbro> I’m not saying that I don’t want to define main
20:10 <nbro> I’m just asking you how would you define it in my case
20:10 <mauke> I don't understand what "your case" is
20:11 janos__ joined
20:11 ij joined
20:12 tienkajreen joined
20:12 <davean> nbro: "Not going to be used as a standalone app" <-- definitionally a library?`
20:12 <nbro> mauke: I didn’t have the time to study more Haskell since the last time, but here’s the thing… I understood that with main :: IO () we’re defining the type of main
20:13 <mauke> yes
20:13 <cocreature> so you need to name your file main.hs but it can’t be the main module?
20:13 robotroll joined
20:13 <nbro> davean: not REALLY going to be used, sorry for not being precise enough
20:13 <bollu> does anyone know of a large-scale app that uses the free monad for DSL design pattern
20:13 <nbro> with that I mean that it can either simply be a file which is loaded into ghci
20:13 <Tuplanolla> You write `module Main where main = ...` into `Main.hs` and put the name of the executable you want in the Cabal file, nbro.
20:13 <nbro> or compiled
20:14 <davean> nbro: so ... don't definate it as the Main module, or don't tell GHC to compile it as a library
20:14 <mauke> ghc -c yourfile.hs IIRC
20:14 <kuribas> How can I stop the ghci debugger from entering an expression?
20:14 <davean> nbro: "loaded into GHCi but not run as an executable" is a type of library
20:14 janos___ joined
20:15 hyuke joined
20:16 <nbro> davean: yeah, but the point is that this an assignment and they have not specified if they are going to compile the file or simply load it in ghci, and this is the reason why I’m asking you “nonsensical” things
20:16 <nbro> so I was just wondering the best way according to you
20:16 <nbro> given my situation
20:16 <kuribas> If that's not possible the ghci debugger is pretty useless...
20:16 <davean> nbro: have it do whatever you want it to do?
20:17 <Tuplanolla> Contact the authors, nbro. We couldn't possibly guess.
20:17 <monochrom> "will load in ghci" does not resolve the ambiguity between library and executable.
20:17 <davean> nbro: either you have a thing you want main to do, or you don't. If you don't, don't define a main, its not an executable. If you do, define a main and declare it to do what you want.
20:18 <monochrom> For all you know they are going to enter ":main" which requires an executable-track file.
20:18 <monochrom> err, s/are/may be/
20:18 <monochrom> And then at some point you realize that it is a false dichotomy.
20:19 <monochrom> You go ask them "do you want main or not?" and code up accordingly.
20:19 coot joined
20:21 <nbro> so, essentially, I want it to be compiled and at the same time I don’t need it to be compiled
20:22 janos__ joined
20:22 <nbro> I think
20:22 Deide joined
20:22 aarvar joined
20:22 <nbro> Tuplanolla: if I use your method “module Main where main =“ it says “parse error (possibly incorrect indentation or mismatched brackets)” while compiling
20:23 <nbro> I’ve indendented all lines of code and comments
20:23 <davean> nbro: Theres no problem compiling a file thats not an executable
20:23 <nbro> not sure why it still claims
20:23 <davean> nbro: are you missing a "do"?
20:23 <mauke> nbro: did you put something after the '='?
20:23 <mauke> because just 'main =' is a syntax error
20:23 <monochrom> Where can we read the assignment verbatim, and where can we read your code verbatim?
20:24 <monochrom> Statistics show that 80% of students overlook 20% of the assignment text. This is known as the 80-20 rule.
20:24 <lpaste_> Tuplanolla pasted “Main Module” at http://lpaste.net/353244
20:24 <nbro> I know these problems are stupid and are due because I’ve still not learned
20:24 ragepandemic joined
20:24 <nbro> but I didn’t have time
20:24 <ph88> anyone know some good examples how to use holesOf, lastOf and filtered from lens ?
20:24 <nbro> so that’s why a lot of stupid questions come here
20:24 <mauke> nbro: what does the assignment actually say?
20:25 Tristan-Speccy joined
20:25 <nbro> mauke: there are some exercises, it’s not important
20:25 <nbro> the assignment is finished
20:25 <mauke> nbro: it is important
20:25 <mauke> since you're apparently struggling with it
20:25 <mauke> and not telling us what the constraints actually are
20:25 <nbro> mauke: not really
20:25 <monochrom> If it is finished, we can all go home now.
20:26 <nbro> Haskell is not difficult as people like to rate it
20:26 <nbro> IMO
20:26 <nbro> I simply just spent only 3 hours reading
20:26 louispan joined
20:27 <nbro> but I would have concrete questions, if you want to answer...
20:27 <bollu> nbro: haskell isn't hard, just different IMO
20:27 <nbro> yeah, indeed
20:27 <bollu> nbro: yes, go on, what is your question?
20:27 <mauke> I had a concrete question, but apparently you don't want to answer it
20:27 <bollu> nbro: it's just that it is _so different_ that it is mind bending :P
20:27 <bollu> nbro: I feel quite dumb 90% of the time with haskell and I love it ^_^
20:28 <monochrom> There was probably no assignment in the first place.
20:28 <nbro> usually you define a module as follows “module NameOfModule where …”
20:29 zcourts_ joined
20:29 <mauke> haskell eschews assignments. it was probably a binding
20:29 marfoldi joined
20:29 <bollu> mauke: lol
20:29 <nbro> if it’s main, I also need to set main, so in the case suggested by “Tuplenolla” he/she did “module Main where main = putStrLn "Works for me"“
20:30 <nbro> my question is
20:31 <nbro> why exactly do we need to set main?
20:31 <bollu> nbro: what are you trying to do?
20:31 <monochrom> It is required for an executable.
20:32 <hpc> main is the thing that is run
20:32 <hpc> when you compile and run a haskell program
20:32 <c_wraith> nbro: it's the same thing as main in C
20:32 <hpc> (or just about any sort of program)
20:32 <monochrom> Similarly why do some python files have __main__? (Or whatever it's called.)
20:32 <c_wraith> nbro: you have to tell the compiler where the program starts *somehow*
20:32 <hpc> python executes in the top-level scope
20:32 <bollu> monochrom: that is quite different though
20:33 <monochrom> Ah OK.
20:33 <nbro> or another question would be: what kind o expressions (or statements?) are allowed to be in the main definition? Are there some restrictions?
20:33 <c_wraith> nbro: the convention is that it's the IO action named main in the module named main
20:33 <hpc> there's a magic __main__ variable in every scope that says if that's the module that's being executed
20:33 <c_wraith> err, the module is named Main
20:33 <bollu> monochrom: __main__ is used to control what happens when you import a module
20:33 <c_wraith> nbro: any value with a type unifying with IO a can be main
20:33 <c_wraith> nbro: however, it's usually good to make it IO (), as that can prevent some bugs
20:34 <hpc> this means the behavior of a module is different if you import it vs running it, imports can produce side effects even without bringing anything into scope, and imports are order-dependent
20:34 rgr joined
20:34 <hpc> using main avoids a lot of those misfeatures
20:34 <bollu> hpc: I had once worked on a codebase that was un-testable since it depended on everything being imported in some order. writing unit tests against modules was a no-op
20:35 <hpc> (and IO prevents even more)
20:35 <monochrom> Haha this is great. Haskell main is for executables. Python __main__ is for libraries.
20:35 <bollu> hpc: it was hilariously sad
20:35 <hpc> monochrom: yeah, python is one of my least favorite languages
20:35 <AndreasK> If seen python __main__ used as entry point for applications as well often enough
20:35 defaultnick joined
20:36 oisdk joined
20:36 <hpc> i could probably go on for hours, but it wouldn't belong here and i have other things to do ;)
20:37 <Tuplanolla> When you don't, the world needs a Python critique that doesn't focus on indentation, hpc.
20:37 <c_wraith> I think anyone who's used python can provide that critique.
20:38 takle joined
20:38 <monochrom> I only critique the official Python tutorial of using fibonacci in an example. :)
20:38 <monochrom> of? for?
20:38 <c_wraith> english is hard, let's go haskelling. :)
20:38 <monochrom> @quote monochrom fibonacci.*natur
20:38 <lambdabot> monochrom says: the fibonacci sequence is everywhere in nature, for example haskell tutorials and python tutorials
20:38 newbie39 joined
20:39 andrei_chiffa__ joined
20:39 <bollu> lol
20:39 gawen joined
20:39 <bollu> that is hilarious
20:39 <monochrom> :)
20:39 takle joined
20:39 <hpc> i miss some of the old quotes
20:39 <bollu> hpc: such as?
20:39 <hpc> majestic stereo, especially
20:39 <lolisa> Hi, so in haskell we can do memo by constructing infinite trie.
20:39 <c_wraith> is that one gone?
20:39 <hpc> @quote majestic.stereo
20:39 <lambdabot> monochrom says: Welcome to #haskell, where @remember's are in majestic stereo!
20:40 <bollu> I don't geddit
20:40 <hpc> oh, it's still there in some form at least
20:40 <lolisa> However can we modifty it so it work on infinite data type?
20:40 <monochrom> lolisa: Infinite list and infinite binary search tree also work.
20:40 <hpc> bollu: it used to happen really often, but when people would ask questions here, they would get answers from multiple people almost immediately
20:40 <hpc> and those answers would be identical
20:40 <nbro> imports need to be specified before the definition of main, right?
20:41 <lolisa> Like how?
20:41 <hpc> so someone said "welcome to #haskell, where questions are answered in majestic stereo"
20:41 zcourts joined
20:41 <bollu> hpc: heh, I see
20:41 <c_wraith> nbro: syntactically, yes. imports belong before any definitions
20:41 <bollu> hpc: I like the haskell community the best
20:41 <nbro> ok, thanks!
20:41 <bollu> like, best part of hasell
20:41 <c_wraith> nbro: module header, imports, declarations
20:41 <hpc> eventually the prevailing answering style turned into two people alternating through the same answer
20:41 <hpc> and most of the time coming out looking like one coherent explanation
20:42 <c_wraith> sometimes we have 4 people. :)
20:42 <hpc> so the quote changed to "welcome to #haskell, where questions are answered in contrapunctual fugue"
20:42 <bollu> hpc: ooh, that had happened to me. With you, Cale, and merijn IIRC :P
20:42 <monochrom> I invented that one.
20:42 <Tuplanolla> Distributed lambdabot could handle that.
20:42 <bollu> hpc: you were trying to tell me what "higher kinded" was
20:42 <bollu> IIRC
20:42 <nbro> how do you manage to have time to be here all the day?! lol
20:42 <hpc> heh
20:42 <bollu> hpc: any other quotes?
20:43 bollu joined
20:43 Guest4561 joined
20:43 <hpc> dunno
20:44 lak joined
20:45 mdarse joined
20:45 connrs joined
20:46 <bollu> also, what the hell are the "photontorpedo" quotes IIRC?
20:46 <bollu> they were ridiculous
20:46 <bollu> @quote photontorpedo
20:46 <lambdabot> No quotes match. My mind is going. I can feel it.
20:46 <bollu> hm
20:46 <c_wraith> protontorpedo
20:46 <thoughtpolice> @protontorpedo
20:46 <monochrom> They were a troll.
20:46 <lambdabot> scheme, lisp, php, python, perl, tcl, al banned
20:47 pleax joined
20:47 <monochrom> But they became so funny, we created a dedicated lambdabot storage.
20:47 <bollu> I see
20:47 <bollu> lol
20:47 <bollu> @protontorpedo
20:47 <lambdabot> and haskell is not a lisp. correct? holy shit then m learning haskell
20:47 <bollu> (can I spam?)
20:48 <nbro> :t maybe
20:48 <lambdabot> b -> (a -> b) -> Maybe a -> b
20:48 <monochrom> No, but you can pm lambdabot for more
20:48 <nbro> :D
20:48 <bollu> ooh, right, thanks
20:48 ner0x652 joined
20:48 deepfire joined
20:49 whaletechno joined
20:49 steeze joined
20:52 <nbro> hey, guys, I guess this has probably been discussed many times, but what do you haskellers not like about Haskell?
20:52 bennofs1 joined
20:53 takle joined
20:54 <monochrom> I don't like plain text files.
20:54 <davean> nbro: I don't like that I can't serialize computations
20:54 <bollu> "Shiruka says: the operations with irc://irc.freenode.net:6667/# in GHC gain their speed from the fact that they are executed on the newer and hence superior and faster .NET platform" my god, that is gold
20:55 <MarcelineVQ> having to write out all the superclass instances of a given class instance instead of being able to selectively choose what ones I want to over-ride if at all
20:55 <stevenxl> i folks. Quick question - how do I turn changeset errors into user-friendly messages?
20:55 <stevenxl> For example: `%{title: ["should be at least 3 characters"]}` how does that get transformed into "Title should be at least 3 characters"
20:55 <MarcelineVQ> that could be shorter: *boilerplate
20:55 <stevenxl> I can certainly write the function myself, but just wondering if there's already a function in ecto i should be using
20:55 eschnett joined
20:55 xubunto joined
20:56 <bollu> "sum is just the free monoid functor applied to the mediating arrow of the terminality of ()" <- someone explain this to me?
20:56 <stevenxl> woops
20:56 <stevenxl> sorry wrong chan!
20:57 <c_wraith> bollu: sounds like gibberish to me
20:57 <bollu> c_wraith: yeah
20:57 <xubunto> almost as if someone wanted to sound smart
20:58 deepfire joined
20:59 <bollu> "TacticalGrace says: irc://irc.freenode.net:6667/#haskell in action: discussion about first-year teaching turns into an argument about CT and Kan extensions" I would love for some context on this
20:59 <c_wraith> :t getSum . foldMap (const 1)
20:59 <lambdabot> (Foldable t, Num c) => t b -> c
21:00 <bollu> c_wraith: is that the context?
21:00 <c_wraith> No, that's a demonstration of how to actually write sum using a free monoidal approach
21:00 <bollu> c_wraith: how is this "free monoid"?
21:01 <c_wraith> as foldMap is more or less toFreeMonoid
21:01 conal joined
21:01 mwilly joined
21:01 <ski> @ghc
21:01 <lambdabot> Bad eta expand
21:01 <c_wraith> bollu: http://comonad.com/reader/2015/free-monoids-in-haskell/
21:01 <bollu> c_wraith: ooh, thanks
21:02 dan_f joined
21:02 xubunto left
21:03 <dbohdan> I found what looks like another discrepancy in how Haskell's socket Handles behave under Windows and *nix.
21:03 <davean> dbohdan: I'm not suprised, which one is this?
21:03 <dbohdan> If you kill a lightweight thread waiting on hGetLine on a Handle on *nix, it stops the thread instantly. On Windows, it waits for hGetLine to receive its input.
21:04 castlelore joined
21:04 <dbohdan> http://lpaste.net/1112499561634463744
21:05 justanotheruser joined
21:05 takle joined
21:08 Guest4561 left
21:08 yumh joined
21:09 <bollu> 'dibblego: says: category theory and spring are quite different types of "hard to understand". it is possible to come to understand category theory for example.'
21:09 <benzrf> lol
21:09 oberstein joined
21:09 <bollu> this one too: "Coq is a tool for turning ordinary programs into POPL papers"
21:09 <benzrf> true
21:10 anuxivm left
21:11 drostie joined
21:11 <dbohdan> From what I've seen so far my impression is that you shouldn't use socketToHandle in applications intended to run on both *nix and Windows. Is this reasonable?
21:12 zcourts_ joined
21:14 hsk3 joined
21:14 albertus1 joined
21:15 treehaqr joined
21:15 Destol joined
21:16 mwilly joined
21:16 louispan joined
21:16 defaultnick joined
21:17 grayjoc joined
21:19 SepakoRayl joined
21:19 <SepakoRayl> yo
21:19 takle joined
21:20 <hsk3> yo
21:20 <SepakoRayl> guys is anyone familiar with Alex?
21:21 <SepakoRayl> I am having a small problem with strictness
21:22 fuzzy_id joined
21:22 tomphp joined
21:23 snow_lemurian joined
21:24 <dmwit> ?where justask
21:24 <lambdabot> Just ask your question. If somebody knows, they'll answer. If not, they won't, and you'll wait around; it will be no worse than having nobody who wants to claim expertise.
21:24 <bollu> "this is like pokemon but with type systems" oh my god, that is gold
21:24 Nerterologist joined
21:24 tnks joined
21:25 <ertes> sounding smart is not that difficult: "inheritance is just an end of products in the category of meta-meetings"
21:26 takle joined
21:26 bjz joined
21:27 <SepakoRayl> ok here is the thing Alex provides an `alexMonadScan :: Alex result`
21:27 <SepakoRayl> how do I format code snippets?
21:28 freusque joined
21:28 <dmwit> ?where paste
21:28 <lambdabot> Haskell pastebin: http://lpaste.net/
21:29 LuckyRawApe joined
21:29 <bollu> :t (??)
21:29 <lambdabot> Functor f => f (a -> b) -> a -> f b
21:29 <bollu> oh, OK
21:30 mjs2600 joined
21:30 MindlessDrone joined
21:32 arawack joined
21:33 ploop joined
21:34 Koterpillar joined
21:36 Gurkenglas_ joined
21:36 fizruk joined
21:36 prohobo joined
21:37 prohobo left
21:37 Guest96711 joined
21:38 ploop joined
21:39 defaultnick joined
21:41 _sg2 joined
21:41 xaviergmail joined
21:43 sellout- joined
21:45 cschneid_ joined
21:45 f-a joined
21:48 moet joined
21:49 fendor joined
21:49 DisruptiveNL joined
21:52 tj_ joined
21:53 hiratara joined
21:54 snow_lemurian joined
21:55 yumh joined
21:55 raichoo joined
21:55 systadmin joined
21:57 mjs2600 joined
21:59 meoblast001 joined
21:59 Nicnux joined
22:01 mszczygiel joined
22:07 Destol joined
22:07 zcourts joined
22:09 drostie joined
22:10 zcourts_ joined
22:12 abrar joined
22:14 doux joined
22:14 tomphp joined
22:16 prkc joined
22:16 Boomerang joined
22:18 doux joined
22:20 hazmat__ joined
22:21 WalkGood joined
22:22 bob3434 joined
22:22 halogenandtoast joined
22:22 pita left
22:22 inari joined
22:23 johnmendonca joined
22:23 Guest16896 left
22:24 suica joined
22:25 conal joined
22:28 <suica> I'm trying to write a simple regex parser for expressions like "ab(cd|e)*f", but it's recursing infinitely and I can't quite figure out why -- anything obviously incorrect here? http://lpaste.net/353247
22:29 tomphp joined
22:29 hyuke joined
22:30 Fairy joined
22:30 JeanCarloMachado joined
22:30 chao-tic joined
22:30 <f-a> what is Parser, suica
22:31 akhov joined
22:31 hiratara joined
22:31 <lyxia> suica: you have a loop between p_nonseq, p_alt, p_expr
22:32 peterbecich joined
22:32 <suica> sorry, `newtype Parser a = Parser { runParser :: String -> Maybe (a, String) }`
22:32 <suica> lyxia: thanks, let me see
22:34 geekosaur joined
22:36 mofasa_ joined
22:37 kubuntu joined
22:37 JagaJaga joined
22:38 <mofasa_> Is there any way to load a module which imports another local module into GHCi without creating a cabal file? E.g. A.hs imports B.hs, then stack repl A.hs yields "Failed to load interface for 'B'"
22:39 louispan joined
22:40 <lyxia> mofasa_: where are your modules located
22:40 <mofasa_> same folder
22:41 <lyxia> oh I see, stack is behaving differently from ghci...
22:41 vct joined
22:42 <vct> does anyone else use intero with spacemacs?
22:43 takle joined
22:43 louispan_ joined
22:44 Voldenet joined
22:44 Voldenet joined
22:45 tommd joined
22:45 <suica> lyxia: thanks! one issue I'm having conceptually is how I can make it parse "ab|cd" as `Alt (Seq (Sym 'a') (Sym 'b')) (Seq (Sym 'c') (Sym 'd'))` -- it'll always do the greedy thing where it parses to `Just (Seq "ab", "|cd")` (removing Sym's for clarity), with "|cd" as the unparsed remainder.
22:45 ddere joined
22:46 <Cale> suica: Add something to the parser which insists that you're at the end
22:46 <Cale> oh, hadn't seen your parser type
22:46 <Cale> If you use Maybe like that, you can't have backtracking, so it's trickier
22:46 pita joined
22:47 <suica> hmm I see
22:47 <lyxia> You might be able to reorder your rules to make it work...
22:47 raycoll joined
22:48 <lyxia> flip the two alternatives in expr
22:48 <lyxia> oh no, single is in nonseq
22:49 fre2 joined
22:50 JeanCarloMachado joined
22:50 Bernouli joined
22:50 f-a joined
22:51 amuck joined
22:52 mjs2600 joined
22:52 zeroed joined
22:55 <suica> yeah, it's difficult to think about for me -- hard to figure out what limitations are imposed by my parser type
22:57 <lyxia> You'll need a way to test whether you're at the end of the string, because you can always append more stuff after a regexp to get a longer regexp
22:59 jutaro joined
23:01 mac10688 joined
23:01 drostie joined
23:01 fendor joined
23:05 tommd joined
23:06 Nerterologist joined
23:07 takle joined
23:08 ploop joined
23:09 justan0theruser joined
23:09 amuck joined
23:12 amuck joined
23:13 takle joined
23:17 augur joined
23:17 takle joined
23:21 benl23 joined
23:21 takle_ joined
23:22 Rizy joined
23:23 Welkin joined
23:23 Denthir joined
23:23 dpepsilon joined
23:23 dpepsilon joined
23:24 bob3434 joined
23:24 robertkennedy joined
23:24 Fairy joined
23:24 JoshS joined
23:26 <athan> How's the situation for uploading haddock documentation to hackage? I can do it with Neil Mitchell's `neil` utility, but I think the hyperlinks are off - should I just wait for hackage to do it?
23:26 <Welkin> hackage will fail :O
23:26 <Welkin> upload it yourself
23:26 <athan> u_u right on
23:26 <athan> thanks Welkin
23:27 tromp joined
23:30 f-a left
23:30 buglebudabey joined
23:30 <lyxia> it's working okay now
23:31 defaultnick joined
23:34 coltfred joined
23:37 <robertkennedy> I've started writing a paper, but I have no idea if the research I'm working on is original. How can I feel confident that I'm adding something?
23:38 <robertkennedy> Well the research is original; hopefully you know what word I'm looking for.
23:38 <Tuplanolla> It's an eternal problem, robertkennedy.
23:38 <monochrom> exhaustive search of the literature.
23:41 louispan joined
23:41 exferenceBot joined
23:42 <robertkennedy> If you don't mind me trying to spark recognition: is there a function `get` and a constructor `:&&:` so `get (True :&&: "test" :&&: 'y') == 'y'` and `get (True :&&: "test" :&&: 'y') == "test"`
23:43 <Tuplanolla> I don't get it.
23:43 <Koterpillar> robertkennedy: what's the difference between those two expressions?
23:43 <monochrom> I think you have typos.
23:44 stef204 joined
23:45 oisdk joined
23:45 <robertkennedy> I don't.
23:45 <monochrom> Then there is none.
23:45 m0rphism joined
23:46 NickHu joined
23:46 <monochrom> You have a constant c, and ask for get c = 'y' and get c = "test".
23:46 <robertkennedy> The first uses `get :: a :&&: b :&&: c -> b` and the second uses `get :: a :&&: b :&&: c -> c`
23:46 <monochrom> Ah
23:47 halogenandtoast joined
23:47 <lyxia> what's the trick
23:48 <robertkennedy> I've written such a function, `get :: c `Has` a => c -> a`; the paper I've begun to write exploits it a lot.
23:48 <monochrom> Multiple parameter type class.
23:48 conal joined
23:49 gugah joined
23:49 TxmszLou joined
23:50 <robertkennedy> And closed type families, and "advanced overloading", a GHC wiki article I can't find atm
23:51 Denthir left
23:51 SepakoRayl joined
23:51 <lyxia> Okay I see.
23:54 snow_lemurian joined
23:54 Levex joined
23:55 <robertkennedy> monochrom: what's your feeling in general when seeing multiple parameter type classes?