Search Haskell Channel Logs

Sunday, March 5, 2017

#haskell channel featuring snow_lemurian, ski, kadoban, Welkin, Sornaensis, zipper, and 6 others.

zipper 2017-03-05 17:03:53
Hey is there like isInfixOf that is case insensitive?
zipper 2017-03-05 17:04:00
A substring search
dmwit 2017-03-05 17:05:24
map toLower x `isInfixOf` map toLower y -- ?
kadoban 2017-03-05 17:05:26
zipper: The usual pattern for that type of thing is: use toLower on both the needle and the haystack
zipper 2017-03-05 17:05:51
hmm
Koterpillar 2017-03-05 17:07:15
weird unicode might mess with you here
Axman6 2017-03-05 17:07:16
there is a case insensitive string type used in some of the HTTP libs which might be useful
Axman6 2017-03-05 17:08:20
yeah you want to be sure this isn't for weird text, like in german the capital for 'ss' is a single character IIRC
zipper 2017-03-05 17:08:45
Koterpillar: Exactly my issue
zipper 2017-03-05 17:09:03
I want to check whether something is unicode from the content type
zipper 2017-03-05 17:09:06
Which is bytestring
zipper 2017-03-05 17:09:08
lol
snow_lemurian 2017-03-05 17:09:23
Why not use (<$> toLower) `on` isInfixOf ?
zipper 2017-03-05 17:09:30
There is char8.isInfixOf
Koterpillar 2017-03-05 17:09:40
content-type from an HTTP header?
Koterpillar 2017-03-05 17:09:45
HTTP headers are ASCII-only
zipper 2017-03-05 17:09:46
snow_lemurian: That assumes a string
zipper 2017-03-05 17:09:53
Koterpillar: Oh :)
zipper 2017-03-05 17:10:01
Koterpillar: That clears it all up
zipper 2017-03-05 17:11:24
`decodeASCII` Deprecated: Use `decodeUtf8` instead
ski 2017-03-05 17:11:59
> isLower 'ß'
lambdabot 2017-03-05 17:12:01
True
Koterpillar 2017-03-05 17:12:35
ski: for completeness, that thingy is available in caps too
dmwit 2017-03-05 17:13:03
zipper: `decodeLatin1` is not deprecated
dmwit 2017-03-05 17:13:13
It covers all of ASCII and a bit more besides.
dmwit 2017-03-05 17:13:33
And unlike UTF8 won't ever fail.
zipper 2017-03-05 17:14:05
Why is charachter encoding so weird :(
ski 2017-03-05 17:14:41
Koterpillar : yeah, i was just looking for it :)
ski 2017-03-05 17:14:44
> isUpper 'ẞ'
lambdabot 2017-03-05 17:14:47
True
ski 2017-03-05 17:14:58
> toUpper 'ß' -- however, :/
kadoban 2017-03-05 17:14:59
Because characters are so weird ... because languages are so weird.
lambdabot 2017-03-05 17:15:01
'\223'
dmwit 2017-03-05 17:15:08
...because humans are so weird.
dmwit 2017-03-05 17:15:25
It's weird turtles all the way down.
Axman6 2017-03-05 17:16:16
ski: yeah that's the one, thought that was the uppercase char but guess it's the other way
ski 2017-03-05 17:16:43
iirc, it's a ligature of `sz'
Koterpillar 2017-03-05 17:17:01
> toUpper 'ß' == 'ß'
lambdabot 2017-03-05 17:17:04
True
ski 2017-03-05 17:17:10
aye
ski 2017-03-05 17:18:22
one might have thought that `forall c. isLower c = True => isUpper (toUpper c) = True'
Axman6 2017-03-05 17:19:03
but one would be wrong!
Welkin 2017-03-05 17:19:20
wolud two be wrong?
Axman6 2017-03-05 17:19:33
if n is wrong, n+1 is also wrong
Axman6 2017-03-05 17:19:47
one is the base case
Welkin 2017-03-05 17:19:47
what about n-1?
Axman6 2017-03-05 17:19:57
uh, n-1
ski 2017-03-05 17:20:05
depends ..
Koterpillar 2017-03-05 17:20:19
how do you get lambdabot to print unicode?
ski 2017-03-05 17:20:34
> text "ẞ"
lambdabot 2017-03-05 17:20:37
ski 2017-03-05 17:20:47
> text "ß"
lambdabot 2017-03-05 17:20:50
ß
Axman6 2017-03-05 17:21:03
:t text
Sornaensis 2017-03-05 17:21:05
> text "°"
lambdabot 2017-03-05 17:21:06
String -> Doc
lambdabot 2017-03-05 17:21:07
°
Koterpillar 2017-03-05 17:21:46
> text $ filter (\c -> isUpper c && toUpper c /= c) $ [minBound..]
lambdabot 2017-03-05 17:21:49
DžLjNjDz
Koterpillar 2017-03-05 17:21:59
> text $ filter (\c -> isLower c && toLower c /= c) $ [minBound..]
lambdabot 2017-03-05 17:22:06
Terminated
ski 2017-03-05 17:23:56
that's interesting. upper-lower ligatures
Koterpillar 2017-03-05 17:24:41
they are called title case
ski 2017-03-05 17:26:15
ah, i see
Koterpillar 2017-03-05 17:26:36
not even that
jle` 2017-03-05 17:35:48
can i put latex math into haddock docs?
jle` 2017-03-05 17:36:17
i see this PR https://github.com/haskell/haddock/pull/465 that claims to let you do it, but, i'm not sure how to do actually do it
jle` 2017-03-05 17:37:24
what are the delimiters?
jle` 2017-03-05 17:37:34
it doesn't seem to be in the haddock docs
zipper 2017-03-05 17:39:34
dmwit: I'm afraid that will break later when I try to decode utf8
zipper 2017-03-05 17:39:40
if something sneaky gets past
MarcelineVQ 2017-03-05 17:40:53
jle`: I've not used haddock but this part seems relevant https://github.com/haskell/haddock/pull/465/files#diff-3d298f660a24334a44b167637240db7d
jle` 2017-03-05 17:42:56
hm it looks like docs were added here https://github.com/haskell/haddock/pull/525/files
jle` 2017-03-05 17:43:39
but the official docs as they are hosted online are outdated
jle` 2017-03-05 17:43:39
this PR was merged last june so like i wonder what happened
jle` 2017-03-05 17:43:39
MarcelineVQ: ah thanks!