<    April 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
00:00 newhoggy joined
00:01 takle joined
00:10 <saylu> For example:
00:10 <saylu> https://www.irccloud.com/pastebin/gp70rZrx/
00:11 <saylu> I'd like to either keep the ® character, or URL encode it, but it's already in my CSV so I've got to read it in somehow without escaping to something like \174
00:12 newhoggy joined
00:14 mac10688 joined
00:14 peterbecich joined
00:16 takle joined
00:16 conal joined
00:22 newhoggy joined
00:23 takle joined
00:28 peterbecich joined
00:29 peterbecich joined
00:30 peterbecich joined
00:31 peterbecich joined
00:32 newhoggy joined
00:41 peterbecich joined
00:41 Pupnik joined
00:54 takle joined
01:00 abhiroop joined
01:03 shayan_ joined
01:16 roboguy` joined
01:20 alqatari joined
01:30 takle joined
01:35 tnks joined
01:37 ysgard joined
01:48 takle joined
01:53 systemfault joined
01:55 systemfault joined
01:57 conal joined
02:00 takle joined
02:01 newhoggy joined
02:08 newhoggy joined
02:10 abhiroop joined
02:13 takle joined
02:15 peterbec` joined
02:16 roboguy` joined
02:18 ysgard joined
02:25 takle joined
02:36 MotherFlojo joined
02:42 roboguy` joined
02:43 takle joined
02:43 roboguy` joined
02:44 roboguy` joined
02:47 tonywu joined
02:50 jmiven joined
02:51 exferenceBot joined
02:55 takle joined
02:56 hexagoxel joined
03:00 ysgard joined
03:03 conal joined
03:08 newhoggy joined
03:09 takle joined
03:15 eacameron joined
03:20 abhiroop joined
03:27 takle joined
03:41 ysgard joined
03:49 abhiroop joined
03:53 vaibhavsagar joined
04:11 takle joined
04:14 geekosaur joined
04:14 systemfault joined
04:22 ysgard joined
04:26 Pupnik_ joined
04:31 mac10688 joined
04:41 takle joined
04:46 ali_bush joined
04:46 ali_bush joined
04:48 takle joined
04:52 MotherFlojo joined
05:03 ysgard joined
05:07 takle joined
05:15 takle joined
05:18 harfangk joined
05:22 takle joined
05:27 Sose_ joined
05:30 peterbec` joined
05:41 takle joined
05:45 ysgard joined
05:49 abhiroop joined
05:51 nicknovitski joined
05:57 takle joined
06:01 vaibhavsagar joined
06:05 abhiroop joined
06:06 <Axman6> saylu: are you using a CSV parsing library?
06:08 crave joined
06:08 <Axman6> I've used cassava a lot, it should Do The Right Thing. btw what string you're seeing still contains the ® character, if you print the Text (instead of using show bia print) you'll see its still there
06:09 <Axman6> it hasn't escaped anything
06:10 <Axman6> 
06:10 <Axman6> tanaka®
06:10 <Axman6> blehPrel>
06:10 <Axman6> putStrLn "tanaka\174"
06:10 <Axman6> >>> tanaka®
06:11 takle joined
06:22 holygun joined
06:26 wei2912 joined
06:26 ysgard joined
06:28 takle joined
06:31 chessai joined
06:33 abhiroop joined
06:36 takle joined
06:36 crave joined
06:51 nickolay joined
06:53 MotherFlojo joined
06:56 gibbers joined
06:56 gibbers_ joined
07:07 ysgard joined
07:12 takle joined
07:19 takle joined
07:23 yellowj joined
07:31 MotherFlojo joined
07:37 nepiktaz joined
07:37 abhiroop joined
07:47 MotherFlojo joined
07:49 ysgard joined
07:50 takle joined
07:58 takle joined
08:02 MotherFlojo joined
08:04 zeksd joined
08:10 abhiroop joined
08:22 takle joined
08:22 abhiroop joined
08:29 thc202 joined
08:31 abhiroop joined
08:32 sproingie joined
08:32 sproingie joined
08:37 newhoggy joined
08:39 <crave> Hai!
08:39 <crave> In one short sentence, what is "Lens" for?
08:43 abhiroop joined
08:45 <tuturto> crave: Lenses are good for querying and modifying a complex data structure.
08:46 <crave> Is Map a "complex data-structure"?
08:47 <tuturto> yeah, maybe even drop the complex from my sentence
08:47 <tuturto> you can certainly use lenses with Map
08:48 <tuturto> mind you, I haven't really used lenses beyond playing with them a bit
08:48 <crave> Is it usual to see lenses with maps or is it more useful with other data-structures?
08:49 <tuturto> I have mostly seen them with nested records
08:50 <crave> What's that?
08:50 dmi3y joined
08:50 bvad joined
08:50 <crave> Oh you mean records behind a relation in a DB?
08:51 <crave> Nevermind it's something completely different.
08:51 <tuturto> no, from here: http://learnyouahaskell.com/making-our-own-types-and-typeclasses
08:51 <tuturto> record syntax
08:52 <tuturto> and you can nest those
08:52 <tuturto> instead of using String, Int and other types that come with Haskell
08:52 <tuturto> one could define Address that holds information about address
08:53 <tuturto> and Person that holds person details, including Address
08:54 dmi3y joined
08:54 <tuturto> and then do: city (address person) to get the city where person lives
08:54 <tuturto> that's what I meant with nested records
09:26 <nickolay> so what is the community consensus about "modern" records?
09:27 <nickolay> (prefixing record fields names is horrible)
09:29 <MarcelineVQ> what is a modern record?
09:29 newhoggy joined
09:29 <nickolay> some library like http://nikita-volkov.github.io/record/
09:31 <MarcelineVQ> hadn't heard of it, interesting
09:32 <nickolay> I also saw some proposal on wiki, that was using dot notation, looked very simple and "natural"
09:32 <nickolay> so I'm curious what people actually use for records, in new projects
09:33 sproingie joined
09:33 sproingie joined
09:37 kritzcreek joined
09:39 Godfrey joined
09:42 nepiktaz joined
09:42 abhiroop joined
09:43 <nickolay> I guess I'll use the "record" lib, looks awesome
09:44 godfrey joined
09:58 dni- joined
10:07 netheranthem joined
10:09 vlad256 joined
10:10 tapirus joined
10:12 Gloomy joined
10:12 condy joined
10:13 vlad256 left
10:21 djfo joined
10:28 Gurkenglas joined
10:31 abhiroop joined
10:36 grayjoc joined
10:42 Levex joined
10:42 Levex joined
10:45 holygun joined
10:47 prophile joined
10:48 wildlander joined
10:50 Gurkenglas joined
11:08 holygun joined
11:28 initiumdoeslinux joined
11:29 prophile joined
11:34 sproingie joined
11:35 newhoggy joined
11:37 slomo joined
11:38 yellowj joined
11:43 abhiroop joined
11:46 Durbley joined
11:50 newhoggy joined
11:56 merijn joined
12:07 zero_byte joined
12:08 djfo joined
12:15 moei joined
12:17 mengu joined
12:43 newhoggy joined
12:50 pilne joined
12:52 newhoggy joined
12:57 Gloomy joined
13:03 newhoggy joined
13:13 djfo joined
13:16 govg joined
13:18 hphuoc25 joined
13:19 holygun joined
13:19 nickolay joined
13:26 hphuoc25 joined
13:31 abhiroop joined
13:34 sproingie joined
13:34 sproingie joined
13:38 pbrant joined
13:43 abhiroop joined
13:49 takle joined
13:50 Pupnik joined
13:53 newhoggy joined
14:05 newhoggy joined
14:10 Deide joined
14:13 sproingie joined
14:14 newhoggy joined
14:17 meandi joined
14:17 takle joined
14:18 madjestic joined
14:18 takle joined
14:19 newhoggy joined
14:20 conal joined
14:24 kieran joined
14:24 madjestic joined
14:26 abhiroop joined
14:28 newhoggy joined
14:30 hphuoc25 joined
14:35 Gurkenglas joined
14:39 newhoggy joined
14:40 systemfault joined
14:44 nickolay joined
14:48 newhoggy joined
14:54 newhoggy joined
14:56 acarrico joined
14:59 ralu joined
15:04 newhoggy joined
15:04 godfreygyz joined
15:09 newhoggy joined
15:10 shainer_ joined
15:21 newhoggy joined
15:28 Levex joined
15:32 dni- joined
15:33 newhoggy joined
15:35 abhiroop joined
15:36 stef204 joined
15:38 grayjoc joined
15:41 newhoggy joined
15:46 conal joined
15:46 Deide joined
15:48 <LiaoTao> I'm redoing Project Euler using Haskell for fun and learning
15:48 <LiaoTao> http://lpaste.net/354852
15:48 <LiaoTao> If someone could give some critique to a beginner I would very much appreciate it
15:50 binaryplease joined
15:50 bvad joined
15:57 newhoggy joined
15:59 razvanc-r[m] joined
16:00 <adarqui_> looks pretty good to me. not sure performance-wise though. I personally like doing something like this once i've figured out how my 'long one liner will work':
16:00 <adarqui_> oops i think i broke your l-paste, i clicked edit, but thinking it would give me a new one
16:00 <adarqui_> http://lpaste.net/354852
16:01 <adarqui_> sorry lmao
16:01 <adarqui_> LiaoTao: ^
16:02 arquebus joined
16:02 <glguy> LiaoTao: it looks like you're packing too much logic into one line, I'd break it up. it looks like your function reimplemented map, could you write it using map?
16:02 conal joined
16:04 <LiaoTao> adarqui_, glguy Thanks, I'll have another look
16:05 <glguy> LiaoTao: do you know about this:
16:05 <glguy> > [2,4..10]
16:05 <lambdabot> [2,4,6,8,10]
16:05 <LiaoTao> No I did not!
16:06 <LiaoTao> v. handy
16:08 newhoggy joined
16:10 texasmynsted joined
16:12 meandi_2 joined
16:16 newhoggy joined
16:22 mac10688 joined
16:24 abhiroop joined
16:25 newhoggy joined
16:31 hphuoc25 joined
16:31 takle joined
16:32 kieran joined
16:36 godfrey joined
16:41 <LiaoTao> http://lpaste.net/354859
16:41 <LiaoTao> Second try
16:41 newhoggy joined
16:41 grayjoc joined
16:44 kieran_ joined
16:45 <glguy> LiaoTao: There's not much point to using foldl' when building up a list. foldl' will only force the head of the list
16:46 <glguy> takeWhile (<n) [x,2*x..] can be: [x, 2*x .. n-1]
16:46 <glguy> union can stream some outputs, foldr is a good candidate here
16:47 <LiaoTao> glguy, Okay, thank you
16:47 <glguy> and because union appends internally (lhs ++ f rhs), using foldr will be more efficient, too
16:48 shainer joined
16:48 newhoggy joined
16:52 conal joined
16:54 newhoggy joined
17:02 chrissl joined
17:02 sproingie joined
17:04 sproingie left
17:05 newhoggy joined
17:06 mizu_no_oto_work joined
17:10 AndreasK joined
17:11 newhoggy joined
17:14 abhiroop joined
17:15 c_my_nick joined
17:16 <c_my_nick> i am using attoparsec and have a function with a return type of `State ParserState (Parser r)`. the function is supposed to parse some stuff, append the results of the parser to the state, and then return the results inside the Parser monad.
17:16 <c_my_nick> how do i get the result back into the Parser monad? http://lpaste.net/354860
17:17 <geekosaur> the general answer is pure or return
17:18 <c_my_nick> yeah, i am using return, but it is returning the value in the wrong monad (State instead of Parser)
17:20 newhoggy joined
17:27 <c_my_nick> this is so frustrating. every tutorial on the State monad is way too simple and just rehashes all of the same stuff everyone else has already said ><
17:29 <geekosaur> I don't think anyone here can help without more information. many of the functions used there are not identified at least to their types, and ideally you'd have the full error message and an indication of what lines correspond to what
17:31 newhoggy joined
17:31 <c_my_nick> all of the functions that matter have a type signature. line 6 is where the error is located
17:33 <Akii> annotated a obvious solution >_>
17:33 <Akii> at least from the types given and the error msg
17:35 <c_my_nick> yeah, that was already my starting point *before* introduced the State monad.
17:35 <Akii> amended that just yet
17:35 bvad joined
17:37 <c_my_nick> ok, so then how do i have a copy of the results so that i can return a `State ParserState (Parser a)` and take the `a` (in this case, [Construct]) and append it to the state (ParserState)?
17:38 kieran_ joined
17:40 <monochrom> I am 99% sure "State ParserState (Parser a)" is the wrong thing to want in the first place.
17:40 <c_my_nick> the application is a database dump file converter. i have to parse and reformat the table creation queries in place, then at the very end (after all of the insert statements are run), it generates indexes/constraints on the tables
17:41 <c_my_nick> ok, what do i want instead?
17:41 <monochrom> StateT ParserState Parser a
17:42 <c_my_nick> ok, i did try that as well and i was getting the same error (in the paste, i just changed `return` to `lift`)
17:43 <monochrom> No, keep it "return". It is the "skipMany whatever" stuff that needs lift.
17:43 <c_my_nick> ok, give me a minute here to try that
17:43 <monochrom> You have been reading State for the 2nd millionth time, but have you read StateT?
17:44 newhoggy joined
17:44 <c_my_nick> not really ><
17:44 <monochrom> "This changes everything. Again."
17:45 <monochrom> Richard Bird's textbook has a section on this.
17:46 <c_my_nick> ah ha, there we go
17:48 <c_my_nick> i did try a combination of return/lift with StateT, but i was just using lift in the wrong spot
17:48 <c_my_nick> thanks for the help
17:48 <glguy> note that you'll run into trouble if you want to use things like sepBy that take parsers as arguments
17:48 Gloomy joined
17:50 <c_my_nick> hm, i will keep that in mind. i only need to keep track of the state at a fairly low point in the parsing process
17:50 Majiir joined
17:51 <monochrom> If it's parsec, it already has a place for "user state" which is good for your ParserState, you won't need StateT and its limitations.
17:51 <c_my_nick> attoparsec. i have to parse really big files
17:52 newhoggy joined
17:52 <lpaste> saylu pasted “function with multiple output possibilities” at http://lpaste.net/354865
17:52 <saylu> Hey guys! Any quick advice on slimming this set of functions to just one?
17:53 <glguy> saylu: to support multiple result types merge all the types into one. you can use Either or make a custom sum type
17:55 <lpaste> saylu revised “function with multiple output possibilities”: “function with multiple output possibilities” at http://lpaste.net/354865
17:55 <saylu> glguy: Something like this?
17:56 NeverDie_ joined
17:56 MotherFlojo joined
17:57 <saylu> The tuples are rough
17:59 Gurkenglas joined
18:00 <monochrom> You need data constructors.
18:00 <monochrom> Review how algebraic data types are defined.
18:02 <saylu> Off I go
18:05 newhoggy joined
18:06 zero_byte joined
18:09 TerNit joined
18:12 <TerNit> How to refute (m `mplus` n) >>= k = (m >>= k) `mplus` (n >>= k) -- left distribution for Maybe ?
18:12 <glguy> saylu: separately you seem to be misunderstanding what (.) is. it's not the same as ($). you can avoid both and just use ()s
18:14 abhiroop joined
18:18 newhoggy joined
18:19 mizu_no_oto_work joined
18:24 newhoggy joined
18:25 <hexagoxel> TerNit: consider how it simplifies if m or n is Nothing.
18:26 ralu joined
18:27 abhiroop joined
18:28 <hexagoxel> TerNit: (that was just a hint to get you closer to the solution, not the solution itself)
18:32 newhoggy joined
18:33 hphuoc25 joined
18:36 mizu_no_oto_work joined
18:42 kieran_ joined
18:47 m3tti joined
18:48 <TerNit> hexagoxel: Thank you
18:48 newhoggy joined
18:53 newhoggy joined
18:53 acarrico joined
19:01 newhoggy joined
19:04 abhiroop joined
19:06 newhoggy joined
19:15 newhoggy joined
19:20 Cale joined
19:25 conal joined
19:26 newhoggy joined
19:29 smichel17 joined
19:31 newhoggy joined
19:34 systemfault joined
19:36 newhoggy joined
19:42 newhoggy joined
19:46 Mutter joined
19:51 argent0 joined
19:52 newhoggy joined
19:55 geekosaur joined
19:57 kieran_ joined
19:59 Levex joined
19:59 madjestic joined
20:03 newhoggy joined
20:06 AndiK joined
20:08 newhoggy joined
20:13 newhoggy joined
20:16 <c_my_nick> ok, now i really have no clue what i am doing. i originally wrote this application 4 years ago and didnt understand how the pipes part of it worked then (a coworker wrote that part for me). now i want to modify it to use StateT instead of IORef. http://lpaste.net/354868
20:19 <c_my_nick> i have my `StateT ParserState Parser a` parsers, but i cant figure out how to use them with the parsed function from pipes-attoparsec https://hackage.haskell.org/package/pipes-attoparsec-0.5.1.5/docs/Pipes-Attoparsec.html
20:20 <glguy> c_my_nick: this is an example of what I was warning you about like with sepBy
20:20 ysgard joined
20:22 <c_my_nick> yeah, i know. what do you recommend i do?
20:23 <madjestic> what are pros and cons of using glfw-b and sdl for processing user input events?
20:24 ysgard joined
20:25 newhoggy joined
20:29 <lpaste> mac10688 pasted “Code too slow :(” at http://lpaste.net/354869
20:29 <mac10688> Hi all, I'm working on a codeingame problem. When I run the test cases it says that the code isn't fast enough
20:30 <mac10688> I was wonder if anyone sees something obvious
20:30 <mac10688> basically I'm traversing a graph breadth first to find a gateway node, then I want to report a link to remove
20:30 <mac10688> complicated codeingame story lol
20:30 <glguy> c_my_nick: You can using runStateT to get the Parser out
20:31 <jle`> mac10688: it looks like you're doing a lot of ++
20:31 <jle`> someLongThing ++ [x]
20:31 <mac10688> yeah that's what I was thinking of, but I really need the order
20:31 <mac10688> i guess I could append to front and do a reverse
20:31 <mac10688> is that something you would suggest?
20:31 <jle`> yeah, can you just construct it in reverse and then reverse at the end?
20:32 <jle`> yes, repeated ++ is extremely expensive
20:32 <mac10688> i'll give that a go
20:32 <jle`> especially on the left side
20:32 <jle`> it's basically O(n^r), where n is the length of the list and r is the times you repeat it
20:32 <jle`> oh um that might be wrong
20:32 <jle`> but it's still bad heh
20:33 <jle`> alternatively you can use a diff list isntead of a list, which has cheap ++'s
20:34 hphuoc25 joined
20:34 <mac10688> yeah I guess the one that could really kill it is when I'm trying to append the node links to the array that I'm using like a queue
20:35 <mac10688> I guess I should look into using a queue structure, I'm just afraid codeingame won't have the queue container because it's not in base prelude
20:36 <jle`> you can make a basic queue pretty easily
20:36 <mac10688> that runs fast?
20:36 <jle`> using the two-list method
20:36 <jle`> yeah
20:37 <mac10688> "you can use a diff list" what is that?
20:37 <jle`> a diff list is a ([a] -> [a])
20:37 <jle`> and (++) is cheap in the direction you're using it as
20:38 newhoggy joined
20:38 <jle`> instead of [x], you'd do (x:)
20:38 <jle`> and intsead of (xs ++ ys), you'd do (xs ++) . ys
20:39 <jle`> so you never repeatedly ++, you just do all of the ++'s at once at the end
20:39 <MarcelineVQ> another problem that can come up with codeingame is that it doesn't do so hot with lazy IO, and that can add a lot of time to interleave, so it's best to do your reading strictly right away then work with the data, is it possible to grab the data you need for running loop before running loop instead of within loop?
20:39 abhiroop joined
20:39 TerNit left
20:40 <mac10688> MarcelineVQ, no. Each loop, I print out a link to remove. Then the loop runs again and I get the new position of the virus, where I need to calculate the next link to remove
20:40 <MarcelineVQ> It's probably not a big deal compared to other considerations here, but a couple problems became a lot more tractable when I was able to get all the data upfront
20:41 <mac10688> just need to figure out how to do this diff-list and see where I'm at
20:41 <jle`> data DiffList a = DL ([a] -> [a])
20:42 <jle`> singleton :: a -> DiffList a; singleton x = DL (x:)
20:43 abhiroop joined
20:43 <jle`> toDiffList :: [a] -> DiffList a; toDiffList xs = DL (xs ++)
20:43 <jle`> apend :: DiffList a -> DiffList a -> DiffList a; append (DL xs) (DL ys) = DL (xs . ys)
20:43 <jle`> might be easier without the wrapper too
20:44 <jle`> then singleton x = (x:), toDiffList xs = (xs ++); append = (.)
20:44 <jle`> but if you only 'reverse' once, it might be easiest to just cons and then reverse at the end
20:44 <jle`> and the simple FIFO queue i was talking about earlier basically involves keeping two lists: an "input" list and an "output" list
20:45 <jle`> adding to the queue involves consing onto the input list
20:45 <jle`> taking from the queue involves head-ing the output list
20:45 <jle`> and when the output list is empty, them dump the input list into the output list after reverseing it
20:46 <mac10688> wow. yeah let me see if I can find a way to just reverse it
20:46 newhoggy joined
20:46 <mac10688> I did write those functions down if I end up needing to use it
20:47 m3tti joined
20:47 aarvar joined
20:53 <mac10688> I suppose concat and ++ would have the same runtime
20:53 <mac10688> there is a point where I do have to concatenate two lists to build up the queue
20:55 newhoggy joined
20:56 abhiroop joined
20:59 <madjestic> I see '^L' in a haskell source file, I think I've never seen this before...
20:59 <jle`> is it in a string, maybe?
20:59 <jle`> > "^L"
20:59 <lambdabot> "^L"
21:03 newhoggy joined
21:04 <mac10688> jle`, I think i understand your idea behind DiffList it looks like you gave me all the functions I need except one. To turn DiffList into a list
21:04 <jle`> ah, yes, that is important
21:04 <jle`> fromDiffList :: DiffList a -> [a]; fromDiffList (DL xs) = xs []
21:04 NeverDie joined
21:04 <mac10688> perfect!
21:06 <jle`> the advantage is that `(((xs ++ ys) ++ zs) ++ as) ++ bs` basically has to re-allocate x completely from scratch several times
21:06 <jle`> *xs
21:06 <jle`> xs is re-allocated completely 4 different times
21:07 <jle`> but ((((xs ++) . (ys ++)) . (zs ++)) . (as ++)) . (bs ++) doesn't have to do that
21:07 NeverDie_ joined
21:07 <jle`> and if you called it with a parameter, it would pre-pend bs, then as, then zs, then ys, then xs
21:07 <jle`> and prepending is cheap
21:08 <jle`> or well, not cheap, but done only once
21:08 <jle`> xs will only be re-allocated once
21:08 newhoggy joined
21:08 <mac10688> that kind of makes sense, I'll be able to think more clearly when I have it implemented
21:12 abhiroop joined
21:15 <glguy> > '\^L'
21:15 <lambdabot> '\f'
21:15 <glguy> There's also that syntax for escaping control characters
21:18 newhoggy joined
21:27 MotherFlojo joined
21:29 conal joined
21:29 Bane^ joined
21:37 tractatus joined
21:37 <mac10688> ok I'm trying to think this through. For using a DiffList in a recursive function. Does it still buy me something knowing that I want want to get head of the DiffList with each function call?
21:37 <mac10688> I'm guessing I need to make another method for DiffList to materialize the head as well
21:43 <abhiroop> Can someone please explain, in the notation Γ⊢TY σ:κ where TY is subscript, what does the TY mean? I mean I know Γ ⊢ σ:κ means in an environment Γ, σ is of type κ
21:46 <jle`> mac10688: it requiring the head every time might make difflist less useful
21:51 <mac10688> oh I think I understand the two list method, I might go with that
21:52 <jle`> the two list method is a simple queue, whch works best if you have ltos of inserts in a row followed by some raeds
21:52 <jle`> but if you can use common data types, look into 'Seq' from the containers package
21:52 <jle`> that's the sort of canonical queue type
21:52 hiratara joined
21:57 <lpaste> tractatus pasted “list of divisors” at http://lpaste.net/354871
21:57 <mac10688> oh ok Data.Sequence
21:57 <jle`> mhm
21:57 <jle`> it's not in Prelude, but 'containers' is pretty ubiquitous, and ghc even uses it
21:57 <tractatus> Hello! I have a problem trying to generate the list of divisors of a number. Could someone help me?
21:58 <tractatus> code: http://lpaste.net/354871
21:58 <jle`> that's a weird error
21:58 <jle`> can you paste the whole error?
21:58 <jle`> and the file?
21:58 <tractatus> me? :)
21:59 <jle`> mhm
21:59 <jle`> 'it' only shows up when you use ghci, mostly
21:59 <pixelfog> madjestic: ^L is the ASCII character for form-feed. People put in text files, not just Haskell, to signal to the printer to skip to the next page.
21:59 <jle`> does the file compile fine without errors?
22:00 <tractatus> Yes, it compiles without errors but when I invoke the the function "divisors" I get that error
22:00 <jle`> how are you invoking it?
22:00 <jle`> that's probably the most important part :)
22:00 <tractatus> I'm loading it in ghci, is it a problem? I'm still a total noob at Haskell
22:00 <jle`> since that's where the error is actually happening
22:00 <jle`> we can't know
22:00 <jle`> until you show us how you are invoking it
22:01 <tractatus> I load the file with :l and then i type something like divisors 9 in ghci
22:01 <tractatus> The whole file is the one i loaded
22:01 <tractatus> And in a moment a put on lpaste the complete error if needed
22:02 newhoggy joined
22:03 <geekosaur> divisors :: (Floating a, Integral a, RealFrac a) => a -> [a]
22:03 Greezler joined
22:03 <geekosaur> that's not going to work...
22:03 <jle`> yeah, adding type signatures will help you find out what's going on :)
22:03 <jle`> there is no type supports all of the operations you're using on it
22:03 <jle`> there is no type that can be modded *and* square rooted
22:03 <tractatus> Oh, i see
22:03 <geekosaur> tractatus, Haskell does not automatically "cast" values to different types
22:04 netheranthem joined
22:04 <tractatus> Then I should cast explicitly, right?
22:04 <jle`> and you also truncate something, so there's another operation that complicates things
22:04 <jle`> you can, but there might be a simpler way
22:04 <jle`> listTilSqrt n = take (truncate (sqrt n)) [2..]
22:05 <jle`> takeWhile (\x -> x*x < 20) [1..]
22:05 <jle`> > takeWhile (\x -> x*x < 20) [1..]
22:05 <lambdabot> [1,2,3,4]
22:05 <jle`> that way you don't have to square root anything
22:05 <jle`> but yeah otherwise yuo can convert 'n' into something that you cna square root, using 'fromIntegral' or something like that
22:05 kadoban joined
22:06 <tractatus> Oh wow, that was clever xD
22:06 <jle`> i didn't think of it :)
22:08 <tractatus> thank you jle :)
22:08 <jle`> no problem!
22:09 <jle`> but yeah, putting type signatures on your functions would have helped you get to the bottom of this quicker
22:09 <jle`> the error message is admittedly a bit cryptic
22:09 <jle`> then you would have caught the error when you tried to give a type signature to listTilSqrt
22:11 Greezler joined
22:16 thebardian joined
22:17 thebardian left
22:21 zero_byte joined
22:27 malaclyps joined
22:30 systemfault joined
22:31 hiratara joined
22:52 newhoggy joined
22:54 <mac10688> It looks like to use Sequence for a queuing structure, I will use the viewr function
22:54 <mac10688> :t viewr
22:54 <lambdabot> error:
22:54 <lambdabot> • Variable not in scope: viewr
22:54 <lambdabot> • Perhaps you meant one of these:
22:54 <mac10688> viewr :: Seq a -> ViewR a
22:54 <mac10688> I'm just wondering how I can get the element out of ViewR now
22:55 <kadoban> You can pattern match at least. I forget if there's a function that does it or not
22:55 conal joined
22:55 Greezler joined
22:58 <mac10688> It seems to have two constructors, EmptyR and (Seq a) :> a
22:58 <mac10688> I'm not sure how to pattern match the second one
22:58 <geekosaur> xs >: x
22:58 <geekosaur> er
22:58 <geekosaur> xs :> x
22:59 <mac10688> oh and x would be the head?
22:59 <geekosaur> yes
22:59 <mac10688> cool!
23:06 NeverDie joined
23:07 kieran_ joined
23:11 abhiroop joined
23:22 boek joined
23:28 MotherFlojo joined
23:29 jrajav joined
23:33 rstefanic joined
23:39 yellowj joined
23:42 binaryplease joined
23:42 sigmundv__ joined
23:44 mengu joined
23:44 taksuyu joined
23:44 eacameron joined
23:47 binaryplease joined
23:48 taksuyu joined
23:51 conal joined
23:55 eacameron joined
23:57 vaibhavsagar joined
23:59 kieran_ joined