<    March 2017    >
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 _2_4 25  
26 27 28 29 30 31
00:06 ali_bush joined
00:06 ali_bush joined
00:08 ysgard joined
00:11 Ayey_ joined
00:12 NoCreativity joined
00:13 albertus1 joined
00:14 albertus1 joined
00:16 albertus1 joined
00:17 ali_bush joined
00:17 ali_bush joined
00:23 Apocalisp joined
00:27 ali_bush joined
00:38 ali_bush joined
00:38 ali_bush joined
00:45 Levex joined
00:45 eacameron joined
00:48 <mounty> Can I ask for some help with a puzzling sample. http://pastebin.com/eV2tMM4S
00:48 <mounty> The source is there, and the error message as a comment at the end.
00:49 <mounty> It seems to me that since route :: DT.Text -> MaybeKey -> Foundation.Handler YC.Html
00:49 <mounty> that route value :: MaybeKey -> Foundation.Handler YC.Html
00:49 <mounty> but obviously ghc disagrees.
00:51 <mounty> I know that (\value -> return $ return $ route value) could be written points-free but I'm fiddling around trying to work out what's going on.
00:52 <jle`> try adding a type annotation to it
00:52 <jle`> you might have an extra 'return' ?
00:53 <mounty> jle` how come line 48 is OK then? I mean, it doesn't cause any error message.
00:54 <mounty> Although, looking at it again, it should because "YC.redirect $ Foundation.AuthR YA.LogoutR" isn't of type MaybeKey -> Foundation.Handler YC.Html
00:54 <jle`> hard to tell without knowing the types for everything
00:54 <jle`> but just because you use 'return . return' somewhere correctly doesn't mean that it's correct somewhere else :)
00:55 <jle`> i recommend using do notation and case statements instead of maybe, too, if the problem is tricky
00:55 <mounty> Ugh do.
00:55 <jle`> blah <- Y.iopt Y.textField label
00:55 <jle`> case blah of
00:55 <jle`> Just something -> ...
00:56 <mounty> I'm writing Haskell not Java.
00:56 <jle`> do notation is a gift :)
00:56 <mounty> A Trojan horse.
00:56 <jle`> it's a good tool for writing readable code that's easy to understand and debug
00:56 <mounty> OK, I'll give it a go then turn it back when I've fixed it.
00:57 <jle`> but yeah i suspect that you have one too many returns
00:58 yaewa joined
01:00 <mounty> But the error message says one too many "MaybeKey ->". I've just doified it and the error is the same. I've just updated the pastebin. Please refresh.
01:01 <mounty> With just one return the error message is: No instance for (Monad (Y.FormInput Foundation.Handler)) arising from a use of ‘return’
01:02 <jle`> is Y.FormInput Foundation.Handler a type synonym for something?
01:04 <mounty> It's a Monad transformer. https://hackage.haskell.org/package/yesod-form-1.4.11/docs/Yesod-Form-Input.html
01:04 <mounty> But leave this with me for a few minutes. I'm just having another playaround.
01:05 <mounty> The error has moved up to the [] case on line 48.
01:05 <jle`> what did you fix?
01:06 <jle`> if you took out a return to fix it, then you should probably take out a return in line 48 too
01:08 <jle`> the error that you originally had is typically because of an extra return, because the return is treated as 'const'
01:08 <jle`> for example, if 'succ :: Int -> Int', then 'return succ :: a -> Int -> Int)'
01:08 <jle`> so if you're using 'return succ :: a -> Int -> Int' in a place where you'd expect an Int -> Int you'll get that error
01:08 <jle`> expected Int -> Int, got Int -> Int -> Int
01:09 <jle`> (because return = const, for the (->) a Monad)
01:10 levex_ joined
01:10 <jle`> so if you have a "function with too many arguments given" error, a good thing to check is if you have an extra return
01:11 <jle`> (but of course first check if you applied the correct number of arguments. but you already did that :) )
01:11 ali_bush joined
01:11 ali_bush joined
01:12 systemfault joined
01:12 \Mike joined
01:13 <mounty> What I'm trying first is to make all the return values a further call to dispatcher. Obviously that gives unlimited recursion at runtime but it might flush out the problem.
01:13 systemfault joined
01:16 <mounty> adding the constraint (Monad (Y.FormInput Foundation.Handler)) to the type declaration fixes it but just propogates the error up to postScoreR if I add the constraint to that.
01:17 <mounty> So that cannot be the answer.
01:17 <mounty> postScoreR is used by the Yesod framework so I can't add any constraints to it.
01:19 Pupnik joined
01:20 <jle`> oh hm
01:20 <jle`> FormInput is not a monad transformer, it's an applicative transformer
01:20 <mounty> Yep. I thought as much.
01:20 <jle`> it's not a monad, so you can't use >>= with it
01:20 <jle`> but you can use pure, for the case on line 48
01:20 <mounty> Yes. I've just fixed it.
01:21 <mounty> Usually the literature gives a rather ugly usage with lots of <$> and <*>.
01:21 <jle`> you can use do notation with applicatives too, with the ApplicativeDo extension
01:21 <jle`> but i don't think it's possible to do what you originally wanted with only an Applicative instance
01:22 <mounty> I might do that. The current solution is at https://github.com/mounty1/JackRose/blob/master/source/ScorePost.hs
01:22 MotherFlojo joined
01:22 <mounty> I don't like the approach because you have to have a tuple of arity equal to the number of iopt calls; each iopt call corresponds to a button on an HTML form which is POSTed.
01:23 <mounty> I was trying to generalise it with the routeTable declaration.
01:24 <mounty> Anyway thanks again for your help jle`; now that I have a build, I can work out what I really want to do. And that includes looking again at the applicative stuff.
01:24 ysgard joined
01:24 <jle`> no problem
01:29 ali_bush joined
01:29 ali_bush joined
01:40 gpolitis joined
01:41 ali_bush joined
01:41 ali_bush joined
01:46 dennisvennink joined
01:46 uglyfigurine joined
01:46 dni- joined
01:53 systemfault joined
01:53 ali_bush joined
01:53 ali_bush joined
02:06 louispan joined
02:11 Ayey_ joined
02:13 AndiK joined
02:18 Rodya_ joined
02:43 Ayey_ joined
02:44 NeverDie joined
02:46 dennisvennink joined
02:47 dennisvennink joined
02:53 ysgard joined
02:56 micro_ joined
03:00 geppettodivacin joined
03:04 dennisvennink joined
03:12 zero_byte joined
03:13 Ayey_ joined
03:19 <qmm> can a -> b -> b only have two implementations?
03:22 eacameron joined
03:23 MotherFlojo joined
03:24 <parsnip> qmm: there are at least two?
03:24 <parsnip> @def ff (Just []) = Nothing
03:24 <lambdabot> Defined.
03:25 <parsnip> > ff $ Just []
03:25 <lambdabot> Nothing
03:26 louispan joined
03:28 <jle`> qmm: there is only one if you mean forall a b. a -> b -> b
03:28 <jle`> as in, the fully polymorphic version
03:28 <jle`> there is potentially more than one if you have specific a's and b's
03:29 Ayey_ joined
03:29 <parsnip> @undef ff
03:29 <lambdabot> There's currently no way to undefine just one thing. Say @undefine (with no extra words) to undefine everything.
03:29 <parsnip> @undefine ff
03:30 <lambdabot> There's currently no way to undefine just one thing. Say @undefine (with no extra words) to undefine everything.
03:30 <parsnip> @undefine
03:30 <lambdabot> Undefined.
03:30 <parsnip> @def ff (Just x) = if null x then Nothing else Just x
03:30 <lambdabot> Defined.
03:31 MotherFlojo joined
03:34 <parsnip> > map ff [Just [], Just [1]]
03:34 <lambdabot> [Nothing,Just [1]]
03:35 <jle`> parsnip: mfilter (not . null) ?
03:35 dni- joined
03:36 geekosaur joined
03:37 <parsnip> jle`: hmm, interesting, thanks
03:37 emmanuel_erc joined
03:40 <parsnip> my gosh, haskell is so pretty, i miss it.
03:40 <parsnip> i tried to stray, but it's elegance does so much justify the cons to high-level languages.
03:40 <qmm> jle`: only one?
03:40 <qmm> https://www.haskell.org/hoogle/?hoogle=a+-%3E+b+-%3E+b
03:42 <parsnip> qmm: i think the difference is the interesting things they are doing at like a compiler level or something, but they always have to do same thing as far as what "value" they return... iiuc.
03:42 <jle`> qmm: heh, seq/par are kind of cheating because they mess around with strictness
03:42 <jle`> they're kind of hacks with the compiler
03:42 <parsnip> qmm: for `f :: a -> b -> b`, it must always be `f x y = y`
03:43 <jle`> but in an alternative universe, seq would require a typeclass constraint
03:43 <parsnip> qmm: compare how many `g :: a -> a` there are.
03:43 <jle`> `seq :: Seq a => a -> b -> b`, which makes things a little more sane, and preserves the fact that there is really only one polymorphic 'a -> b -> b'
03:45 exferenceBot joined
03:46 <MarcelineVQ> If you feel there's two impementations you'e right, but only because the count starts at one :>
03:47 <MarcelineVQ> :t undefined
03:47 <lambdabot> a
03:49 hexagoxel joined
04:01 systemfault joined
04:07 MotherFlojo joined
04:10 <* ski> . o O ( s/Seq/Eval/ )
04:16 <bitemyapp> hrm
04:20 systemfault joined
04:29 hexagoxel joined
04:29 Rizy joined
04:39 ali_bush joined
04:43 cschneid_ joined
04:46 Gurkenglas joined
04:49 ali_bush joined
04:49 ali_bush joined
04:49 bungoman joined
04:58 aniketd joined
05:00 ysgard joined
05:09 ali_bush joined
05:09 ali_bush joined
05:19 ali_bush joined
05:19 ali_bush joined
05:23 uglyfigurine joined
05:24 dni- joined
05:29 Ayey_ joined
05:30 Rizy joined
05:43 hexagoxel joined
05:52 Ayey_ joined
05:59 louispan joined
06:08 Ayey_ joined
06:21 hexagoxel joined
06:24 MotherFlojo joined
06:31 eacameron joined
06:35 MotherFlojo joined
06:35 exferenceBot joined
06:41 owiecc joined
06:43 ali_bush joined
06:44 Ayey_ joined
06:46 hexagoxel joined
06:51 meandi_2 joined
06:55 ali_bush_ joined
07:13 dni- joined
07:24 ali_bush joined
07:24 ysgard joined
07:26 Rizy joined
07:38 madjestic joined
07:40 ali_bush joined
07:40 ali_bush joined
07:44 MotherFlojo joined
07:48 ali_bush joined
07:48 ali_bush joined
08:00 Durz0 joined
08:01 ali_bush joined
08:05 ysgard joined
08:11 NeverDie_ joined
08:13 kritzcreek_ joined
08:14 ali_bush joined
08:14 ali_bush joined
08:22 eacameron joined
08:25 ali_bush joined
08:25 ali_bush joined
08:28 Phil joined
08:33 Ayey_ joined
08:36 Rizy joined
08:41 freechips joined
08:42 jarshwah joined
08:44 ali_bush joined
08:44 ali_bush joined
08:46 ysgard joined
08:46 t0by joined
09:02 dni- joined
09:06 hexagoxel joined
09:11 uglyfigurine joined
09:15 ali_bush joined
09:15 ali_bush joined
09:16 Levex joined
09:18 ralu joined
09:21 cschneid_ joined
09:21 AndreasK joined
09:25 Levex joined
09:26 Rizy joined
09:26 ali_bush joined
09:26 ali_bush joined
09:28 ysgard joined
09:30 jarshwah joined
09:42 albertus1 joined
09:46 Levex joined
09:47 ali_bush joined
09:47 ali_bush joined
09:52 ali_bush joined
09:52 ali_bush joined
09:59 Pupnik_ joined
10:01 cschneid_ joined
10:02 ali_bush joined
10:02 ali_bush joined
10:09 sdlnv joined
10:09 ysgard joined
10:13 hexagoxel joined
10:20 dennisvennink joined
10:20 ali_bush joined
10:20 ali_bush joined
10:24 albertus1 joined
10:32 pie___ joined
10:34 albertus1 joined
10:34 albertus1 joined
10:35 simendsjo joined
10:38 rockfruit joined
10:50 ysgard joined
10:51 dni- joined
10:54 cschneid_ joined
10:56 dni- joined
10:57 thc202 joined
10:59 eacameron joined
11:06 hexagoxel joined
11:07 Miroboru_ joined
11:08 howdoi joined
11:12 MotherFlojo joined
11:15 netheranthem joined
11:16 Rizy joined
11:18 Miroboru_ joined
11:19 djfo joined
11:21 wildlander joined
11:23 mojjo joined
11:26 louispan joined
11:28 dennisvennink joined
11:32 ysgard joined
11:35 pbrant joined
11:55 ali_bush joined
11:55 ali_bush joined
11:59 takle joined
12:02 nacon joined
12:02 nacon joined
12:11 Rodya_ joined
12:24 Rizy joined
12:30 Robin_Jadoul joined
12:37 corintho[m] joined
12:42 acarrico joined
12:49 eacameron joined
12:51 nepiktaz joined
12:51 initiumdoeslinux joined
13:01 geekosaur joined
13:01 harfangk joined
13:03 Rizy joined
13:13 MotherFlojo joined
13:20 takle joined
13:22 haskellnewb joined
13:22 t0by joined
13:25 harfangk joined
13:27 Apocalisp joined
13:30 merijn joined
13:30 curry[m] joined
13:30 unclechu joined
13:30 prose[m] joined
13:30 dyce[m] joined
13:30 agates joined
13:30 sudoreboot[m] joined
13:34 Durz0 joined
13:36 boris_rh joined
13:52 zero_byte joined
14:01 Apocalisp joined
14:08 eacameron joined
14:14 eacameron joined
14:26 <epta> how to serialize nested JSON in Aeson? http://lpaste.net/5203806646693789696
14:27 Ayey_ joined
14:30 suls joined
14:35 geekosaur joined
14:35 suls_ joined
14:35 blissdev joined
14:49 pie___ joined
15:02 pbrant joined
15:04 eacameron joined
15:14 MotherFlojo joined
15:14 Ayey_ joined
15:19 eacameron joined
15:22 takle joined
15:25 takle joined
15:26 eacameron joined
15:27 takle_ joined
15:28 takle joined
15:41 expo873 joined
15:50 peterbecich joined
15:50 takle_ joined
15:52 takle joined
16:05 cschneid_ joined
16:07 cschneid_ joined
16:07 dongkey joined
16:14 Ayey_ joined
16:23 <qmm> instance Eq TisAnInteger where (==) (TisAn x) (TisAn y) = x == y
16:23 <qmm> (==) is being applied to (TisAn x) and (TisAn y)
16:24 <qmm> what is happening after all of this, the = x == y
16:26 <qmm> oh i see
16:28 <qmm> it's saying that an instance of == applied to two TisAnIntegers, TisAn x and TisAn y, is...
16:29 <qmm> i think it's just saying that an instance of Eq applied two TisAnIntegers is equivalent to running checking their equivalence with == but that doesn't seem right
16:30 <qmm> help? :)
16:30 \Mike joined
16:31 kluvin joined
16:34 <MarcelineVQ> it's saying that to compare two TisAnInteger, compare the Integer they contain with ==
16:34 <MarcelineVQ> this will use Integer's instance of Eq to do the work
16:39 <qmm> oh, it's a trivial example then
16:39 <epta> bump: how to serialize nested JSON in Aeson? http://lpaste.net/5203806646693789696
16:39 <qmm> potentially useful though
16:41 <ski> (fwiw, it can be written as `instance Eq TisAnInteger where TisAn x == TisAn y = x == y')
16:41 eacameron joined
16:41 <MarcelineVQ> It's deceptively deep, it's showing you the fairly trivial example of comparing things by comparing their components, but it's also showing you a really useful thing that will come up often, which is shuttling work off to other instances.
16:41 <MarcelineVQ> That sounds really vague just now but it'll recur often as you work through the book
16:46 <lpaste_> qmm pasted “epta, maybe something like this” at http://lpaste.net/353676
16:47 <lpaste_> qmm revised “epta, maybe something like this”: “epta, maybe something like this (with fromJSON instance for ThingWithNested)” at http://lpaste.net/353676
16:47 <qmm> epta: i don't know what i'm doing
16:48 <lpaste_> qmm revised “epta, maybe something like this (with fromJSON instance for ThingWithNested)”: “epta, maybe something like this (with fromJSON instance for ThingWithNested)” at http://lpaste.net/353676
16:49 jomg joined
16:49 <lpaste_> qmm revised “epta, maybe something like this (with fromJSON instance for ThingWithNested)”: “epta, maybe something like this (with fromJSON instance for ThingWithNested)” at http://lpaste.net/353676
16:49 <qmm> i'm yanking from http://blog.gnclmorais.com/aeson-and-nested-json
16:49 <epta> qmm: what about toJSON?
16:50 <epta> the original question was about toEncoding part actually
16:50 albertus1 joined
16:56 nil_ joined
17:05 Ayey_ joined
17:12 malaclyps joined
17:13 aarvar joined
17:14 MotherFlojo joined
17:17 takle joined
17:18 takle joined
17:37 peterbecich joined
17:37 owiecc joined
17:57 eacameron joined
17:59 Uniaika joined
18:02 haskellnewb joined
18:17 pilne joined
18:24 Ayey_ joined
18:38 expo873 joined
18:40 takle joined
18:45 systemfault joined
18:45 eacameron joined
18:47 mengu joined
18:55 Glooomy joined
18:56 ego joined
19:00 Deide joined
19:04 eacameron joined
19:06 malaclyps joined
19:06 MotherFlojo joined
19:10 mengu_ joined
19:21 takle joined
19:35 aarvar joined
19:36 Tene left
19:37 takle joined
19:46 takle joined
20:00 eacameron joined
20:01 owiecc joined
20:02 aarvar joined
20:05 MotherFlojo joined
20:07 eacameron joined
20:16 louispan joined
20:17 lambdabot joined
20:32 lambdabot joined
20:33 Glooomy joined
20:33 Glooomy joined
20:34 Glooomy joined
20:35 Glooomy joined
20:36 Glooomy joined
20:37 conal joined
20:38 ali_bush joined
20:38 ali_bush joined
20:46 animated joined
20:47 systemfault joined
20:48 ali_bush joined
20:48 ali_bush joined
20:49 kritzcreek_ joined
20:53 MotherFlojo joined
21:00 michaelt joined
21:06 cschneid_ joined
21:09 cschneid_ joined
21:10 djfo left
21:16 nomotif joined
21:18 MotherFlojo joined
21:19 ali_bush joined
21:19 ali_bush joined
21:19 Ayey_ joined
21:28 Apocalisp joined
21:30 Ayey_ joined
21:31 Apocalisp joined
21:32 mengu joined
21:36 patbecich joined
21:36 Apocalisp joined
21:37 patbecich joined
21:43 ttoe joined
21:44 michaelt joined
21:49 conal joined
21:52 hiratara joined
21:52 flounders joined
21:56 louispan joined
22:07 retsuka joined
22:10 Apocalisp joined
22:13 yellowj joined
22:17 _ikke_ joined
22:18 madjestic joined
22:22 Prutheus joined
22:29 <michaelt> #haskell-beginners
22:31 hiratara joined
22:32 dni- joined
22:39 malaclyps joined
22:46 Apocalisp joined
22:46 louispan joined
22:56 ttoe left
22:58 Uniaika joined
22:59 Apocalisp joined
23:00 IRCFrEAK joined
23:02 <chindy> is there a function that has a type like/similar to thid: (('a,'a), ('a,'a)) -> ('a, 'a, 'a, 'a) =
23:02 <chindy> basically transforming a pair of pairs to a 4-tuple
23:08 emmanuel_erc joined
23:09 eacameron joined
23:13 <geekosaur> no; there's very little that works with more than 2-tuples, because they're discouraged for use as anything but ephemeral function results
23:13 <geekosaur> named ADTs are generally superior
23:13 <geekosaur> (and, SML type syntax?)
23:14 <chindy> geekosaur: ocaml.. but sorry, didn't realise it was the wrong language
23:19 <parsnip> hmm, i had a UUID in my record type, so i added aeson-1.1 requirement to stack.yaml. dirty hack for now i guess.
23:30 cschneid_ joined
23:31 <parsnip> how do you work with json data with varying numbers of fields? i know they will all have at least a fixed four number of fields, but they can have various number of other fields, of about a dozen.
23:32 <parsnip> status, uuid, entry and description will be required.
23:34 <parsnip> as i read the aeson pages, most seem to suggest to use record types, but then i'm required to use a fixed number of fields. and expected to use for example default values. should i prepend the record types with `Maybe`?
23:35 louispan joined
23:46 Ayey_ joined
23:47 conal joined
23:48 acarrico joined
23:49 zgrepc joined
23:53 Rodya_ joined
23:56 eacameron joined
23:58 Rizy joined