<    April 2017    >
Su Mo Tu We Th Fr Sa  
 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  
00:04 systemfault joined
00:06 Cale joined
00:18 nicknovitski joined
00:32 systemfault joined
00:40 eacameron joined
00:40 conal joined
00:45 eacameron joined
01:03 morphit joined
01:09 ebsen joined
01:11 nicknovitski joined
01:25 peterbec` joined
01:42 EricPoe joined
01:49 ebsen joined
01:57 mac10688 joined
01:59 Youmu joined
01:59 Rodya_ joined
02:12 takle joined
02:17 dni- joined
02:25 Rodya_ joined
02:30 takle joined
02:34 zgrepc joined
02:41 agates joined
02:42 takle joined
02:49 takle joined
02:51 conal joined
02:57 meandi_2 joined
02:57 exferenceBot joined
02:58 takle joined
03:02 hexagoxel joined
03:05 takle joined
03:08 nicknovitski joined
03:14 Blacink joined
03:26 Rodya_ joined
03:26 peterbec` joined
03:27 takle joined
03:42 takle joined
03:49 takle joined
03:57 conal joined
03:57 takle joined
04:06 dni- joined
04:11 takle joined
04:11 malaclyps joined
04:28 Rodya_ joined
04:28 peterbec` joined
04:37 takle joined
04:46 peterbecich joined
04:49 Mutter joined
04:55 holygun joined
04:57 Durbley joined
05:06 Mutter joined
05:20 azahi joined
05:23 blissdev joined
05:23 takle joined
05:26 myrkraverk joined
05:28 Rodya_ joined
05:33 tnks joined
05:43 Gurkenglas joined
05:51 ThomasLocke joined
05:51 geekosaur joined
05:55 dni- joined
06:02 takle joined
06:14 kobigurk joined
06:20 kobigurk joined
06:23 takle joined
06:29 Rodya_ joined
06:30 peterbec` joined
06:39 pbrant joined
06:41 takle joined
06:49 Dietr1ch joined
06:53 binaryplease joined
06:54 f32ff joined
06:57 Denthir joined
07:02 takle joined
07:21 aphorisme joined
07:23 harfangk joined
07:24 Pupnik joined
07:30 Rodya_ joined
07:31 peterbec` joined
07:35 thc202 joined
07:36 mengu joined
07:36 dni- joined
07:46 ali_bush joined
07:48 takle joined
07:53 mthek joined
07:55 slomo joined
08:09 Gurkenglas joined
08:10 colt44 joined
08:11 kobigurk joined
08:12 vito_swiss joined
08:15 yellowj joined
08:24 madjestic joined
08:25 zero_byte joined
08:26 brennie joined
08:27 mattyw joined
08:28 dmi3y joined
08:30 Rodya_ joined
08:32 peterbec` joined
08:34 takle joined
08:40 Iceland_jack joined
08:45 eacameron joined
08:48 vaibhavsagar joined
08:50 eacameron joined
08:54 mitchty joined
08:55 eacameron joined
08:59 Lokathor_ joined
09:01 Denthir joined
09:03 eacameron joined
09:08 grdryn joined
09:10 galderz joined
09:18 cur8or joined
09:30 eacameron joined
09:31 Rodya_ joined
09:33 peterbec` joined
09:36 eacameron joined
09:36 dni- joined
09:37 yellowj joined
09:39 eacamero_ joined
09:49 cur8or joined
09:51 sirius[m] joined
09:52 eacameron joined
09:52 vikumar joined
09:53 <vikumar> hi there!
09:53 <vikumar> I'm new to Haskell (just managed to understand monads) and I was a bit confused about monad transformers
09:53 <vikumar> The few things I've pulled up on google haven't really made sense to me.
09:53 bvad joined
09:53 <vikumar> Could any one recommend a good resource?
09:55 <tuturto> have you had look at resources here: https://github.com/bitemyapp/learnhaskell/blob/master/specific_topics.md ?
09:55 <tuturto> especially https://github.com/kqr/gists/blob/master/articles/gentle-introduction-monad-transformers.md and http://catamorph.de/documents/Transformers.pdf
09:56 <tuturto> I haven't gotten that far yet
09:56 eacameron joined
09:57 <vikumar> checking it out now
09:58 <Iceland_jack> Hey vikumar
09:58 <vikumar> hi!
09:58 Thanzex joined
09:59 Durz0 joined
10:05 holygun joined
10:05 netheranthem joined
10:06 tnks joined
10:08 kritzcreek joined
10:09 eacameron joined
10:09 dni- joined
10:10 kobigurk joined
10:13 govg joined
10:13 eacameron joined
10:19 Thanzex joined
10:24 mthek joined
10:24 eacameron joined
10:29 eacameron joined
10:31 nobodyzxc joined
10:32 Rodya_ joined
10:33 dici8 joined
10:33 eacamero_ joined
10:42 eacameron joined
10:47 grayjoc joined
10:48 eacameron joined
10:50 dr_robot joined
10:55 eacameron joined
11:02 eacameron joined
11:05 <eatman> Hi! Tell me, what do you use for testing? Something easy to begin with please?
11:07 eacamero_ joined
11:12 <tuturto> eatman: I have been using (albeit very little) quickcheck: http://book.realworldhaskell.org/read/testing-and-quality-assurance.html
11:12 <tuturto> and probably should have a look at HUnit too at somepoint: https://hackage.haskell.org/package/HUnit
11:12 <tuturto> but that I haven't used at all yet
11:13 eacameron joined
11:14 <eatman> tuturto: Thx, reading about QuickCheck right now.
11:26 eacameron joined
11:26 slomo joined
11:27 TCZ joined
11:31 pbrant joined
11:32 ederign joined
11:33 Rodya_ joined
11:33 eacameron joined
11:35 peterbec` joined
11:35 holygun joined
11:41 eacameron joined
11:45 kobigurk joined
11:48 bvad joined
11:48 eacameron joined
11:52 kobigurk joined
11:52 dr_robot joined
11:53 acarrico joined
12:06 vaibhavsagar joined
12:08 eacameron joined
12:10 mthek joined
12:13 chlong joined
12:15 eacameron joined
12:17 javze joined
12:19 eacameron joined
12:26 eacameron joined
12:30 ubsan joined
12:34 Rodya_ joined
12:36 peterbec` joined
12:39 delexi joined
12:44 azahi joined
13:00 harfangk joined
13:01 eacameron joined
13:07 mlehmk joined
13:10 eacameron joined
13:13 AndroUser2 joined
13:15 xificurC joined
13:22 eacameron joined
13:24 delexi joined
13:24 Rodya_ joined
13:28 jathan joined
13:29 Iceland_jack joined
13:36 grayjoc joined
13:38 peterbec` joined
13:39 <eatman> tuturto: any clue on using QuickCheck on a Reader-like monad?
13:40 acarrico joined
13:40 <Akii> :t runReader
13:40 <lambdabot> Reader r a -> r -> a
13:41 <Akii> you can generate an `r` then run checks against the resulting `a`
13:41 <Iceland_jack> quickCheck (\(a :: Int) -> runReader ask a == a) ..... +++ OK, passed 100 tests.
13:42 eacameron joined
13:46 <eatman> Akii, Iceland_jack this implies to know the function beforehand, doesn't it?
13:46 <eatman> I mean, I generate a 'r' for a given function.
13:48 <Akii> "the function"?
13:50 <Iceland_jack> eatman: In this case, "ask :: Reader a a" is your reader
13:50 <Iceland_jack> Do you want QuickCheck to *generate* the reader?
13:50 homonculus joined
13:53 <Iceland_jack> If you want an "arbitrary" reader you can write
13:53 <ski> @let instance (CoArbitrary r,Arbitrary a) => Arbitrary (Reader r a) where arbitrary = reader <$> arbitrary
13:53 <lambdabot> Defined.
13:53 <Iceland_jack> :t fmap reader arbitrary
13:53 <lambdabot> (Arbitrary a, CoArbitrary r, MonadReader r m) => Gen (m a)
13:53 <Iceland_jack> :t fmap reader arbitrary :: (CoArbitrary r, Arbitrary a) => Gen (Reader r a)
13:53 <lambdabot> (Arbitrary a, CoArbitrary r) => Gen (Reader r a)
13:55 carlomagno joined
13:57 <eatman> Well, I simply made "my own reader" as an exercise and then make it an instance of Functor, Applicative etc.
13:57 <eatman> I want QuickCheck to check the laws.
13:58 mizu_no_oto_work joined
14:08 takle joined
14:15 eacameron joined
14:20 eacameron joined
14:26 eacameron joined
14:30 guampa joined
14:34 moei joined
14:36 eacameron joined
14:38 GreySunshine joined
14:38 des_ joined
14:39 peterbec` joined
14:40 eacameron joined
14:41 kobigurk joined
14:46 nepiktaz joined
14:49 eacameron joined
14:55 bvad joined
14:55 eacameron joined
15:00 eacameron joined
15:00 delexi joined
15:00 uglyfigurine joined
15:06 eacameron joined
15:08 dici8 joined
15:11 dmi3y joined
15:11 Rodya_ joined
15:12 iAmerikan joined
15:14 nicknovitski joined
15:15 vikumar joined
15:22 ksimon joined
15:24 GreySunshine joined
15:24 guampa joined
15:26 <GreySunshine> geekosaur: Thanks for yesterday!
15:28 kadoban joined
15:31 xuinkrbin joined
15:33 nepiktaz joined
15:40 peterbec` joined
15:41 senorchang joined
16:00 <mengu> hi all
16:00 <mengu> i'm trying to use aeson
16:00 <mengu> in ghci, i've imported Data.Aeson
16:01 <mengu> in aeson's docs there's a line "decode "[1,2,3]" :: Maybe [Int]"
16:01 <mengu> when i run this line, i get the following err
16:01 <mengu> <interactive>:8:8: error:
16:01 <mengu> • Couldn't match expected type ‘Data.ByteString.Lazy.Internal.ByteString’
16:01 <mengu> with actual type ‘[Char]’
16:01 <mengu> • In the first argument of ‘decode’, namely ‘"[1,2,3]"’
16:01 <mengu> In the expression: decode "[1,2,3]" :: Maybe [Int]
16:01 <mengu> In an equation for ‘it’: it = decode "[1,2,3]" :: Maybe [Int]
16:02 <mengu> why do i get this?
16:02 <Iceland_jack> mengu: Enable overloaded Strings (:set -XOverloadedStrings)
16:02 <mengu> Iceland_jack: i actually did in the .hs file
16:02 <Iceland_jack> or if you're working on a .hs file, add this to the top: {-# Language OverloadedStrings #-}
16:02 <mengu> yup did that
16:02 <mengu> but i had to do it in the ghci too i see
16:02 <Iceland_jack> Then the type will be: decode "[1, 2, 3]" :: FromJSON a => Maybe a
16:05 <mengu> thallada: Iceland_jack
16:05 <mengu> that worked in strings i defined in ghci
16:05 <mengu> but not with a binding i had in file
16:05 <mengu> lol
16:05 <Iceland_jack> Explain
16:06 azahi joined
16:06 <Iceland_jack> You can't do (a = "foo" :: String) and have that work
16:06 govg joined
16:06 <mengu> haskellConf = "{\"server\": {\"host\": \"\",\"port\": 8080}, \"database\": {\"path\": \"db.json\"}}"
16:06 <mengu> that is defined in my .hs file
16:06 <mengu> i import .hs like :l src/Configuration.hs
16:07 <mengu> and do decode haskellConf
16:07 <mengu> and get the same error
16:07 <Akii> how do you decode that?
16:08 <Akii> aha
16:08 <mengu> Akii: decode haskellConf :: Maybe Configuration
16:08 <Akii> nvm
16:09 <Akii> this is an overloaded strings thing
16:09 <Akii> oh it says it there already :/
16:09 <Akii> I'm a slow reader
16:10 <Akii> and you get "Nothing" as result?
16:10 <mengu> nope
16:10 <mengu> i get the error above
16:10 <Akii> the bytestring one?
16:12 <Akii> haskellConf :: IsString a => a
16:12 <Akii> mengu: annotate the function like that
16:13 <Akii> or define the type like that xD
16:13 <Akii> that will automagically convert it to lazy bytestring
16:13 HazyPurple joined
16:13 <Akii> or, well, OverloadedStrings and no type signature should work as well
16:23 <mengu> thanks Akii & Iceland_jack
16:23 GreySunshine_ joined
16:29 <angryMonk> Hi there!
16:30 <angryMonk> Could you guy explain OverLoaded Strings to me?
16:30 <angryMonk> I don't really get why the standard String in the Prelude is so sucky
16:31 mizu_no_oto_work joined
16:32 GreySunshine joined
16:38 adssfg joined
16:38 Gurkenglas joined
16:39 conal joined
16:40 <geekosaur> String is a simple linked list of Unicode codepoints. this is fast and convenient for very short strings, but means the overhead for a single character is 32 bytes on a 64-bit platform --- plus, being a linked list, about the only thing you can do is iterate it
16:41 peterbec` joined
16:44 <angryMonk> huh
16:44 <angryMonk> so are the other strings better?
16:44 HazyPurple joined
16:44 <angryMonk> I think Data.Text is said to be better than String
16:45 <angryMonk> Why is it better?
16:45 <geekosaur> for large amounts f data, the per string overhead is higher (around 32 bytes) but the per character overhead is lower and it's generally faster because it's an array instead of a linked list
16:45 ederign_ joined
16:46 <geekosaur> but you need fairly long strings for it to make sense because the per string overhead is high
16:46 <angryMonk> wait, how is an array better than a linked list in haskell
16:46 <angryMonk> oh shit, alright
16:46 <geekosaur> list !! index is O(n) array_vector ! index is O(1)
16:46 <angryMonk> ignore that!
16:47 <angryMonk> okay, so Data.Text has a bigger overhead when it comes to strings but is better than dealing with String's overhead for characters
16:47 <geekosaur> (but! it's unicode. for String it's codepoints, for Text it's UTF16 so you have indexing problems outside the BMP due to surrogates)
16:47 <angryMonk> what about ByteString
16:47 <angryMonk> wait
16:48 <angryMonk> codepoints?
16:48 <angryMonk> BMP?
16:48 <geekosaur> unicode
16:48 <angryMonk> I think i get that Data.Text uses UTF16 while String uses Unicode
16:48 <angryMonk> Is that correct?
16:49 <geekosaur> no
16:49 <geekosaur> both use Unicode
16:49 <geekosaur> String uses the UTF16 representation
16:49 <angryMonk> okay
16:49 <geekosaur> err
16:49 <geekosaur> Tetx uses TF16
16:49 <geekosaur> String uses raw codepoints
16:49 <angryMonk> What are codepoints?
16:49 <angryMonk> should I just google it?
16:50 <geekosaur> UTF16 can directly represent codepoints from U+0000 to U+FFFF, minus two ranges used to encode codepoints greater than U+FFFF
16:50 <geekosaur> a codepoint is what you might think of as a "character"
16:50 <geekosaur> but a codepont is much larger than a "character"
16:50 <angryMonk> oooh
16:50 <geekosaur> > maxBound :: Char
16:50 <angryMonk> i think i get it now
16:50 <lambdabot> '\1114111'
16:51 <angryMonk> so codepoints are defined in Haskell and become a bit bigger in memory than storing it as UTF16 directly
16:51 <geekosaur> so a rightward pointing arrow → is codepoint U+2192, UTF8 \xE2 \x86 \x92, UTF16 0x2192
16:52 <angryMonk> essentially, abstracting means a tiny bit of overhead. In this case, it isn't required?
16:52 <geekosaur> the range U+0000 to U+FFFF is easier to represent so it's often given a "privileged" status, which is referred to as the Basic Multilingual Plane (BMP)
16:52 <angryMonk> oh
16:52 <angryMonk> okay
16:52 <angryMonk> looks like it's time for me to read up on this stuff
16:53 <geekosaur> yes
16:53 <angryMonk> But when it comes to practical use
16:53 <geekosaur> unicode is actually a quite complicated subject
16:53 <angryMonk> data.text has a larger string overhead but is better than String when it comes to character overhead
16:53 <angryMonk> Essentially, small string -> use String.
16:54 <angryMonk> big string, use Data.Text
16:54 <geekosaur> yes. practically, I think if the strings are usually 16 characters or shorting then String wins, beyond that Text wins
16:54 <geekosaur> *shorter than
16:54 <geekosaur> *shorter then,
16:54 <geekosaur> sigh. still working on first coffee...
16:54 <angryMonk> huh that's a pretty handy thing to remember
16:55 <angryMonk> ouch. Got the late mondays, eh?
16:55 <geekosaur> but it can depend, because ifgyou're doing simple streaming processing a codepoint at a time then String will fuse to very fast loops
16:55 <angryMonk> huh
16:55 <angryMonk> why?
16:55 <geekosaur> because a linked list is a simple foreach loop encoded as data
16:56 <geekosaur> if you generate/read, process, write a list element at a time and nothing holds onto any data, it compiles down to that loop. no list is ever made
16:56 <angryMonk> okay.
16:56 <angryMonk> what happens for an array
16:58 <angryMonk> i'm guessing that the array is checked each time you act on it?
16:58 <geekosaur> it's called stream fusion, and programs thwt can take advantage of it often run faster than the equivalent C program because ghc is very good at optimizing these streams --- you have to write your C carefully to get it to optimize the same way, because C has to watch out for the possibility that some function elsewhere can look at "the list" (except that, when stream-fused, there isn't one)
16:58 <angryMonk> stream fusion, huh
16:59 <angryMonk> that's going on my list
16:59 <geekosaur> this is where Haskell's purity is a major win, ghc can do optimizations that are unsafe in C
17:00 <angryMonk> wait, is it purity?
17:00 <geekosaur> yes
17:00 <angryMonk> seems to be laziness that makes this possible
17:00 <geekosaur> laziness is what enables purity, but it's purity --- the guarantee that the compiler always knows what data is visible elsewhere --- that enables these optimizations
17:00 <angryMonk> okay
17:01 <angryMonk> alright i think i got that
17:01 <angryMonk> time to write a few benchmarks to play with
17:01 <angryMonk> but before that, how is ByteString different?
17:01 <geekosaur> even in C you can annotate things as pure, telling the compiler it can do the less safe (from a C standpoint) optimizations --- but it can't verify your annotations, so you can break things by using it inappropriately
17:02 <geekosaur> ByetString is a simple string of bytes. if all you ever care about is ASCII or ISO8859 then you can think of it as a "string", but really it's a lower level format
17:02 azahi joined
17:02 <geekosaur> it's the format of POSIX pathnames and file streams, and of network streams.
17:02 <angryMonk> huh, that's good to know about C having stream fusion. Going into my list
17:02 <angryMonk> About ByteString, so it's low level
17:03 <angryMonk> i'm guessing it's used to communicate with legacy stuff?
17:03 <geekosaur> it cann ot handle anything larger than a byte, so you must use an encoding like UTF8 to handle Unicode
17:03 <angryMonk> and wherever speed is important?
17:03 <geekosaur> all network streams are ByteString
17:03 <angryMonk> oh
17:03 <angryMonk> so it's still a representation thing for Unicode
17:04 <angryMonk> ByteString just happens to be what network streams use
17:04 <geekosaur> so now you have to deal with encodings. the most common encoding is UTF8 which allows Unicode codepoints to be represented as a ByteString --- but there are other encodings such as ISO8859 and the CJK encodings like Big5 and Shift-JIS
17:05 <angryMonk> are they really important to know?
17:05 <angryMonk> sounds like Unicode is used for everything?
17:05 <geekosaur> so ByteString is pretty much the external representation of data, whether binary or textual, and has to be decoded/unmarshaled into internal format and encoded/marshaled to the external format again
17:05 delexi joined
17:06 <angryMonk> okay
17:06 <geekosaur> usually this is handled transparently, so you don't need to manually encode stuff to putStrLn it --- but if you use the binary interfaces, or the network operations, you need to deal with this
17:06 <angryMonk> umm, how do i learn to do that?
17:06 <angryMonk> to marshall and unmarshall
17:07 <geekosaur> that's where packages like binary and cereal come in (those terms apply specifically to binary data)
17:07 <geekosaur> for textual conversion, Data,Text.Encoding module has encoding/decoding routines
17:07 <angryMonk> huh, that seems interesting.
17:08 <angryMonk> alright.
17:08 <angryMonk> what about the performance?
17:08 <MarcelineVQ> to clarify in case a wire got crossed ByteString is not a representation for Unicode, ByteString is quite literally just some ammount of bytes
17:08 <angryMonk> okay
17:08 <geekosaur> also there's at least 3 ways to deal with binary data: Foreign.Storable, binary/cereal (packetized), and attoparsec (state machine/parsing)
17:09 <angryMonk> Okay, this is pretty awesome
17:09 <geekosaur> data streams work best with Storable or binary/cereal. parsing is best for network protocols, generally, because they're often more free form (command/response, not just a stream of fixed records)
17:09 <angryMonk> How hard is it to convert different string types to each other?
17:10 <angryMonk> wait, you lost me there
17:10 <angryMonk> data streams -> Storable, binary or cereal
17:10 <geekosaur> generally there are functions for it, pack/unpack in both Text and ByteString (the former is to String, the latter to [Word8])
17:10 <geekosaur> think binary data files
17:11 <angryMonk> network protocols -> parsing
17:11 <angryMonk> okay
17:11 <geekosaur> you already know what records are where, so you can just use something that slurps records in and unmarshals into internal format
17:11 <angryMonk> alright, still with you.
17:11 <geekosaur> but for a network protocol you need to process what you receive and respond to it, and the response you make controls what you have to decode next from the stream
17:12 <angryMonk> okay
17:12 <angryMonk> so from what i understand,
17:12 <angryMonk> Storable, binary or cereal and parsing do similar things
17:12 <geekosaur> although generally you as an application programmer will use libraries to deal with this. but the library you use has to use these operations
17:12 <angryMonk> it's just the behaviour that matters
17:13 <angryMonk> hmmm
17:13 <angryMonk> alright, need to look into this, not too sure i got this.
17:13 <angryMonk> no worries
17:13 <angryMonk> .
17:13 <angryMonk> .
17:13 <angryMonk> .
17:13 <angryMonk> How hard is it to convert different string types to each other?
17:14 <geekosaur> [18 17:10:42] <geekosaur> generally there are functions for it, pack/unpack in both Text and ByteString (the former is to String, the latter to [Word8])
17:14 <geekosaur> so generally you'll map String to Text with T.pack (import qualified Data.Text as T) and Text to String with T.unpack
17:14 <angryMonk> alright
17:14 <angryMonk> i think i get it know
17:15 <angryMonk> now*
17:15 <geekosaur> the OverloadedStrings extension does this for you in the specific case of string literals, so you;re not constantly having to say T.pack "foo", T.pck "bar", etc.
17:15 <angryMonk> so, the OverLoadedString extension allows me to write a program that uses String
17:16 <angryMonk> and that program will understand it's actually data.text?
17:16 <geekosaur> well, it lets you write a program that uses string literals without having to deal with the fact that they are String and not Text
17:16 <angryMonk> that sounds useful.
17:16 <angryMonk> Alright
17:16 <angryMonk> how does this break?
17:16 <angryMonk> I'm guessing that OverloadedStrings can break in some cases.
17:16 bvad joined
17:17 <geekosaur> same way Num "breaks"
17:17 <geekosaur> literal strings are polymorphic, so sometimes you have to insert type annotations
17:17 <angryMonk> alright
17:18 <angryMonk> so watch out for explicit type annotations and wherever the compiler is confused.
17:18 <geekosaur> the compiler can deal with this for numbers, but for strings it's a bit harder because String is actually [Char] but it's difficult to support both [Char] and a possible IsString instance for some other kind of list
17:18 <geekosaur> so while numbers have defaulting, strings don't, and sometimes you must insert annotations to say which instance to use (String, Text, etc.)
17:19 LiaoTao joined
17:19 <angryMonk> alright.
17:20 <angryMonk> Sweet, that's made it clear for me.
17:20 <geekosaur> there are workarounds for this, like the mon-traversable package which makes all "string-like" types look and operate identicallyt
17:20 uglyfigurine joined
17:20 <geekosaur> but sometimes you still need type annotations, and sometimes it fails in a way that compiles but produces terrible code
17:20 <angryMonk> Any recommendations for me to read while i practice with this stuff?
17:20 <angryMonk> oh
17:20 <geekosaur> mono-traversable
17:20 <* geekosaur> dropping too many keys...
17:21 <geekosaur> basically it tries to encourage stream fusion to happen regardless of string-like type. when it succeeds it's great, when it fails it fails *very badly* and is constantly packing and unpacking stuff
17:21 <angryMonk> alright
17:22 <angryMonk> that probably explains why you explained each type of string with a specific application
17:22 <geekosaur> yes
17:22 <geekosaur> it's often better to pick one and stick with it, or switch only at layer biundaries
17:23 <angryMonk> sweet
17:23 ederign joined
17:23 <geekosaur> like, a network stream is interleaved commands and data. the commands are usually ByteString, the data may be binary/ByteString or textual/String or Text, but you only do that conversion when feeding the data parts upstream
17:24 <angryMonk> huh, good to know
17:24 <angryMonk> speaking about network streams, how'd you recommend i learn about it?
17:24 <angryMonk> when it comes to haskell
17:25 <geekosaur> even the network protocols that look like strings (e.g. SMTP) can be treated as binary. and in fact were; one reason the 4-uppercase-letter commands convention existed is that they were treated as 32-bit words
17:25 <geekosaur> in fact the C compiler supports a hack that was used for those: multicharacter (char) literals
17:25 <angryMonk> wait, what?
17:26 <angryMonk> multicharacter literals?
17:26 <geekosaur> like 'HELO'. horrid hack and had endian issues between e.g. Vaxes and Suns, but it was convenient :)
17:26 <angryMonk> huh.
17:26 <angryMonk> that's pretty cool
17:27 <angryMonk> i'm guessing that the additional character made it two words instead of one
17:27 <geekosaur> but more generally it;s an indication that even "strings" can be binary data
17:27 <geekosaur> sizeof 'HELO' == 4
17:28 <geekosaur> only usable as a literal, you can;t store it in a (char []) but you can compare it against a (long)
17:28 nobodyzxc joined
17:29 <angryMonk> i swear, someone needs to make a copy of this convo and make a blog post explaining how the different kinds of strings work,
17:29 <geekosaur> neat but horrid and not very portable because you can't, for example, compare it on an intel cpu with data received from a sparc or mips etc.
17:30 <geekosaur> there should be several such already
17:30 <geekosaur> we need to point at them better
17:31 <angryMonk> huh
17:35 mizu_no_oto_work joined
17:39 takle joined
17:42 peterbec` joined
17:46 yellowj joined
17:46 galderz joined
17:56 colt44 joined
17:56 Thanzex joined
18:00 uglyfigurine joined
18:03 GreySunshine_ joined
18:14 takle joined
18:16 pixelfog joined
18:17 govg joined
18:22 slomo joined
18:27 nomotif joined
18:28 <angryMonk> geekosaur, i've done a fair bit of reading on what we've discussed.
18:28 <angryMonk> Thanks a lot for the help!
18:43 peterbec` joined
18:49 malaclyps joined
18:54 delexi joined
19:03 haskelleksah joined
19:04 <haskelleksah> Just reading section 11.2 in the HaskellBook where Normal form as regards to Algberiac datatype is discussed. Not sure if the example given helps in driving home the point…it has not helped that much for me…and I will not be able to copy the example here as it would be cumbersome…but I think the “main” idea that they are trying to explain is the fact that “Product Type Distributes Over Sum Type” more in the way you h
19:04 <haskelleksah> distributive property of product and addition in arithmetic…
19:04 <haskelleksah> but I cant seem to appreciate the profound thing about “Product Type Distributes Over Sum Type” and how this relates to type being in a “Normal form”
19:17 slomo joined
19:17 slomo joined
19:21 tapirus_ joined
19:22 conal joined
19:22 takle joined
19:28 dni- joined
19:31 takle joined
19:37 dmi3y joined
19:45 pixelfog joined
19:45 peterbec` joined
19:45 nschoe joined
20:00 uglyfigurine joined
20:01 uglyfigurine joined
20:04 takle joined
20:10 takle joined
20:10 peterbecich joined
20:14 uglyfigurine joined
20:19 acarrico joined
20:20 mizu_no_oto_work joined
20:39 WarmCookie joined
20:41 angryMonk joined
20:46 peterbec` joined
20:55 pixelfog joined
21:05 developernotes joined
21:05 developernotes joined
21:08 Iceland_jack joined
21:09 <developernotes> bitemyapp any change to the Haskell print book status?
21:13 smichel17 joined
21:17 dni- joined
21:25 dr_robot joined
21:29 javze joined
21:34 sigmundv joined
21:47 peterbec` joined
21:52 zero_byte joined
21:53 hiratara joined
21:53 haskelleksah joined
21:54 ederign joined
22:06 sigmundv_ joined
22:09 zero_byte joined
22:18 netheranthem joined
22:23 pilne joined
22:28 lambdabot joined
22:31 hiratara joined
22:33 netheranthem joined
22:35 <lpaste> saylu pasted “No title” at http://lpaste.net/354712
22:36 <saylu> Hey folks! Struggling with this one.
22:36 <saylu> I've got a `MaybeT IO String` and I'm trying to use `getLine` within it (which produces an IO String)
22:36 <saylu> Totally blanking on what to do here.
22:36 <saylu> Compiler nicely reminds me that it wants a `MaybeT IO String` and I'm giving it an `IO String` here
22:40 <sudoreboot[m]> saylu: Could you use https://www.stackage.org/haddock/lts-7.6/ghc-8.0.1/Maybes.html#v:tryMaybeT ?
22:43 <saylu> Oof, just realized as you sent that that I can put `MaybeT $ do` at the top
22:43 <saylu> instead of just "do"
22:44 <lpaste> saylu revised “No title”: “No title” at http://lpaste.net/354712
22:44 <MarcelineVQ> you need to 'lift' your getLine into the MaybeT, there's two options for that normally
22:44 <saylu> though the guard has me confused; having trouble knowing what that's doing
22:45 <saylu> MarcelineVQ: Could do what I've done with MaybeT $ do ... or use 'lift getLine', correct?
22:48 <MarcelineVQ> sure, but imo avoiding having to write Just v and Nothing explicitly is partly the point of using a transformers so I'd prefer lift or liftIO over MaybeT $
22:48 <lpaste> saylu revised “No title”: “No title” at http://lpaste.net/354712
22:49 <saylu> Right. Much cleaner. I've updated to the two variants in this paste and I prefer the `lift` myself.
22:55 <sudoreboot[m]> I'm also curious about what `guard $ isValid v` is doing
22:56 <* sudoreboot[m]> sent a long message: sudoreboot[m]_2017-04-18_22:56:44.txt - https://matrix.org/_matrix/media/v1/download/matrix.org/bHWSEvofUUAykieecebcAukj
22:56 <MarcelineVQ> for that it's best to look at its source, which afterwards will lead you to look at the Alternative instance for MaybeT
22:57 Iceland_jack joined
22:58 malaclyps joined
23:00 prophile joined
23:01 uglyfigurine joined
23:01 NoCreativity joined
23:03 <sudoreboot[m]> It's beyond me right now, especially at this our.
23:04 <MarcelineVQ> depending on some condition guard will either give you a value that does nothing or a value that signifies some sort of termination
23:04 <MarcelineVQ> > Just "foo" >> guard True
23:05 <lambdabot> Just ()
23:05 <MarcelineVQ> > Just "foo" >> guard False
23:05 <lambdabot> Nothing
23:06 dni- joined
23:06 <MarcelineVQ> > Just 4 >>= \v -> guard True >> return v -- possibly more interesting version
23:06 <lambdabot> Just 4
23:06 <MarcelineVQ> > Just 4 >>= \v -> guard False >> return v
23:06 <lambdabot> Nothing
23:07 <MarcelineVQ> guard True still resulted in Just () there but >> discards it
23:08 <MarcelineVQ> However if you give Nothing to >> you get Nothing back
23:08 <MarcelineVQ> > Just 3 >> return 2
23:08 <lambdabot> Just 2
23:08 <MarcelineVQ> > Nothing >> return 2
23:08 <lambdabot> Nothing
23:08 <MarcelineVQ> So it signifies a sort of termination here
23:11 <sudoreboot[m]> I'm not yet familiar with applicatives or alternatives but it makes sense to me if I understand it correctly
23:13 GreySunshine joined
23:13 <sudoreboot[m]> Thanks for explaining. Now it's time for bed!
23:14 <MarcelineVQ> np, do notation is just another form of using >>= and >> so if that's new to you be sure to look it up later on :>
23:16 nicknovitski joined
23:18 eacameron joined
23:20 epta joined
23:49 peterbec` joined
23:50 texasmynsted joined