Search Haskell Channel Logs

Wednesday, February 1, 2017

#haskell channel featuring Andrea_, samvher, jophish, mbrock, noan, Tuplanolla, and 5 others.

Tuplanolla 2017-02-01 04:45:53
Yes, noan.
Andrea_ 2017-02-01 04:46:41
saizan: ok i exchanged x and s
Andrea_ 2017-02-01 04:46:59
saizan: ok i exchanged st and s
roxxik 2017-02-01 04:47:35
noan: enable, not import, they are already built into ghc. whereas libraries are not part of ghc
roxxik 2017-02-01 04:48:28
noan: and they are directly recognized by ghc, the preprocessor won't touch them
Tuplanolla 2017-02-01 04:49:49
Well, we don't really even have a preprocessor.
Tuplanolla 2017-02-01 04:50:18
There's just a handful of stages.
roxxik 2017-02-01 04:52:21
yah there is this ugly hack of using the cpp
roxxik 2017-02-01 04:53:02
{-# LANGUAGE CPP #-}
merijn 2017-02-01 04:56:26
jophish: I've filed a bug, but tbh I don't have high hopes of it getting fixed any time soon
noan 2017-02-01 04:57:26
roxxik, thanks
jophish 2017-02-01 04:57:33
merijn: good luck
jophish 2017-02-01 05:06:44
mbrcknl: ppsh for ghci?
lpaste 2017-02-01 05:07:43
Andrea pasted "No title" at http://lpaste.net/351882
mbrock 2017-02-01 05:08:06
jophish: something like that :) with colors too
jophish 2017-02-01 05:08:10
ooh, fancy
Tuplanolla 2017-02-01 05:08:26
They don't discuss limitations. Does it actually work correctly, mbrock?
jophish 2017-02-01 05:08:27
hmm, global package installation :|
Andrea_ 2017-02-01 05:08:36
if i replace the push and pop functions with get and put from library, then the code works, but i am not happy with this
jophish 2017-02-01 05:08:40
I wonder if I can nixify ghci
mbrock 2017-02-01 05:09:19
jophish: I just put it as a dependency of my package for now, and I start ghci with -interactive-print=IPPrint.Colored.cpprint
lpaste 2017-02-01 05:09:32
Andrea revised "No title": "State from library" at http://lpaste.net/351882
mbrock 2017-02-01 05:10:29
Tuplanolla: I think it works by lexing `show` output as Haskell, so it should w ork properly unless your `show` generates "weird" output. I've only tried it so far with structures that use derived Show and it seems to work fine
Rodenbach 2017-02-01 05:15:22
The docs at https://hackage.haskell.org/package/utf8-string-1.0.1.1/docs/Data-ByteString-UTF8.html say: „A space-efficient representation of a Word8 vector…". Isn't Word8 limited to 255 chars? From the name I would think that those are UTF-8 strings.
Rodenbach 2017-02-01 05:15:48
From the name ByteString.UTF8.
merijn 2017-02-01 05:17:03
Rodenbach: You seem to be confusing utf-8 and unicode
merijn 2017-02-01 05:17:46
Rodenbach: Word8 is just a byte. utf-8 is a variable length encoding of unicode as bytes. Unicode is an abstraction for representing textual data
merijn 2017-02-01 05:17:59
Rodenbach: ByteString is really just Bytes
merijn 2017-02-01 05:18:41
So it's giving you bytes that contain unicode text encoded as utf-8
Rodenbach 2017-02-01 05:18:43
UTF-8 is an encoding - Unicode is a character set
roxxik 2017-02-01 05:19:36
yup and ByteString.UTF8 uses a bytestring to store UTF8 encoded stuff, and only allows you to use the associated functions to retrieve stuff so as not to break the encoding
Tuplanolla 2017-02-01 05:19:48
Good to know, mbrock. So that's a "no" for exceptions, UTC timestamps, socket addresses, ...
merijn 2017-02-01 05:20:10
Rodenbach: The documentation of ByteString in that modules is just the re-exported documentation from Data.ByteString
mbrock 2017-02-01 05:20:44
Tuplanolla: Quite possibly, I'm not sure. I'd imagine that it falls back to the raw show output for things that can't be parsed, but you'd have to try it.
Rodenbach 2017-02-01 05:21:07
Oki thx
Tuplanolla 2017-02-01 05:21:26
I've tried some other library that did the same thing before and it was not worth the hassle.
merijn 2017-02-01 05:22:03
Rodenbach: Honestly, you probably shouldn't be using that package unless you have some specific use-cases
merijn 2017-02-01 05:22:15
Rodenbach: You should probably use either Text or ByteString
roxxik 2017-02-01 05:23:45
"The utf8-string package: A UTF8 layer for IO and Strings. The utf8-string package provides operations for encoding UTF8 strings to Word8 lists and back, and for reading and writing UTF8 without truncation. "
roxxik 2017-02-01 05:24:17
here it reads what it's intended for, and that's a rather narrow field
samvher 2017-02-01 05:26:18
actually I'm having a utf8 problem as we speak as well
merijn 2017-02-01 05:26:38
samvher: What's the issue?
samvher 2017-02-01 05:26:45
I have a psql database in UTF8 encoding (that's what SHOW SERVER_ENCODING says), but somehow postgresql-simple doesn't read the data correctly
samvher 2017-02-01 05:27:03
they are cyrillic strings
samvher 2017-02-01 05:27:11
and it's read as \1080 and similar
merijn 2017-02-01 05:27:23
> text ['\1080']
lambdabot 2017-02-01 05:27:25
и
merijn 2017-02-01 05:27:37
samvher: I think it's working fine, but you're displaying it wrong :)
samvher 2017-02-01 05:27:37
that's cyrillic
mbrock 2017-02-01 05:27:39
Tuplanolla: for my situation, it's very worth the hassle to be able to debug my program's states and outputs. I'm still a bit sad that the default inspection facilities of Haskell are so poor, though
samvher 2017-02-01 05:27:40
ok
samvher 2017-02-01 05:27:43
I was using show
samvher 2017-02-01 05:27:46
that's wrong?
merijn 2017-02-01 05:28:02
samvher: Let me guess, you're getting Text from the database and then using show? :)
samvher 2017-02-01 05:28:08
haha yes
samvher 2017-02-01 05:28:20
but if I read String from the database the same thing happens
merijn 2017-02-01 05:28:44
samvher: Show, in general, is meant to generate "valid Haskell" as output, therefore show-ing Text/String leads to escaped characters while printing
Tuplanolla 2017-02-01 05:29:07
:t Data.Text.unpack
lambdabot 2017-02-01 05:29:09
Data.Text.Internal.Text -> String
samvher 2017-02-01 05:29:10
ahhh ok. so they are the right characters, just escaped
merijn 2017-02-01 05:29:12
samvher: You will want, for example, hPutStrLn from Data.Text.IO
merijn 2017-02-01 05:29:22
samvher: Which lets you print Text directly
merijn 2017-02-01 05:29:35
Tuplanolla: I would just use the output function from Text directly :)
samvher 2017-02-01 05:29:36
well I have to convert it to Lucid Html
samvher 2017-02-01 05:30:24
I thought I tried toHtml . unpack already, but I think I should be able to figure it out now
merijn 2017-02-01 05:30:26
samvher: Does Lucid take Text or String? If Text it should "just work", if String you'll want to use Data.Text.unpack to get a String without escaping
samvher 2017-02-01 05:30:38
it uses Text
samvher 2017-02-01 05:30:48
ok thanks a lot
merijn 2017-02-01 05:30:53
> "и"
lambdabot 2017-02-01 05:30:56
"\1080"
merijn 2017-02-01 05:31:10
Lambdabot normally uses "show" for output too :)
samvher 2017-02-01 05:31:48
ok, thanks, I was getting quite frustrated :)
samvher 2017-02-01 05:32:50
yes, that will work, I'm getting the right output now
samvher 2017-02-01 05:32:54
:)
merijn 2017-02-01 05:33:01
:)