Search Haskell Channel Logs

Thursday, March 9, 2017

#haskell channel featuring sshine, Jenaf, ezyang, MarcelineVQ, stevenxl, teto, and 9 others.

Welkin 2017-03-09 13:46:10
inferno-cop: that has been taken to its logical extreme with classy-prelude
Welkin 2017-03-09 13:46:17
and it's a monster
Welkin 2017-03-09 13:46:29
too many typeclasses makes the code impossible to understand
glguy 2017-03-09 13:46:35
gaudy-prelude?
inferno-cop 2017-03-09 13:46:44
Oh, I hadn't heard about that, but I can definitely imagine it...
Welkin 2017-03-09 13:46:56
I think the name 'classy' refers to typeclasses :P
`Guest03 2017-03-09 13:47:03
inferno-cop: in that case, either that typeclass had to provide algorithm complexity restrictions or hadn't
`Guest03 2017-03-09 13:47:28
in first case, there are less !'s which could make it into the typeclass
`Guest03 2017-03-09 13:47:54
in the second case, you can write less code or be less sure about its complexity
`Guest03 2017-03-09 13:48:19
have to *
Welkin 2017-03-09 13:49:40
`Guest03: not having generic functions like `fmap` means you can never write generic functions yourself
inferno-cop 2017-03-09 13:49:41
Fair point.
Welkin 2017-03-09 13:49:50
that is horrible
Welkin 2017-03-09 13:49:53
you have a function you want to operate on Lists, and on Array, and on Map, and on etc.
Welkin 2017-03-09 13:50:41
have to copy/paste it several times
Welkin 2017-03-09 13:50:52
it's just stupid
`Guest03 2017-03-09 13:50:52
Welkin: i never said that we don't need generic functions
Welkin 2017-03-09 13:50:52
that is why Elm sucks
Welkin 2017-03-09 13:50:52
at least one reaosn
`Guest03 2017-03-09 13:50:52
i said that i need names for specialized versions too
`Guest03 2017-03-09 13:50:52
defined in modules.
Welkin 2017-03-09 13:50:52
`fmap :: (a -> b) -> [a] -> [b]` -- `Guest03 , done
inferno-cop 2017-03-09 13:50:52
But at the same time, lists, arrays, maps, sets etc are all different in important ways, so writing generic implementations of algorithms for them would seldom be a good idea (if you care about performance)
Welkin 2017-03-09 13:50:52
there is your specialized fmap for List
`Guest03 2017-03-09 13:50:52
Welkin: too verbose
`Guest03 2017-03-09 13:50:52
could just use L.map
Jenaf 2017-03-09 13:50:52
I still have the feeling that I'm producing ugly code:
Jenaf 2017-03-09 13:50:52
ieldReducer rows (a:(b:list))= (fmap (bfRowSetZeroPastN b) (Seq.take (b-a) rows))><(fieldReducer (Seq.drop (b-a) rows) (b:list))
Welkin 2017-03-09 13:50:57
Jenaf: this ain't lisp
Welkin 2017-03-09 13:50:58
!
Jenaf 2017-03-09 13:54:22
I'm quite sure I don't have the perfect representation of the Problem I want to tackle.
MarcelineVQ 2017-03-09 13:54:37
`Guest03: it's bad form for a bot to guess what you intend, it tends to produce noise
`Guest03 2017-03-09 13:54:57
that's bad if noise is very bad
MarcelineVQ 2017-03-09 13:55:06
noise is very bad
`Guest03 2017-03-09 13:55:19
it's not very bad for me...
Welkin 2017-03-09 13:55:21
Jenaf: something more like this http://lpaste.net/353366
Welkin 2017-03-09 13:55:27
but add type signatures to your functions
`Guest03 2017-03-09 13:55:35
okay
Jenaf 2017-03-09 13:56:04
I think i always have signatures
Jenaf 2017-03-09 13:56:13
thats what i start with when writin a function
Welkin 2017-03-09 13:56:35
Jenaf: I see you are using list comprehensions in your code as well
Welkin 2017-03-09 13:56:45
try to avoid those, especially for your use case
Welkin 2017-03-09 13:56:50
just use a simple `filter` instead
Jenaf 2017-03-09 13:57:00
can you tell me an example line?
Jenaf 2017-03-09 14:04:37
what I don't really like is stuff like
Jenaf 2017-03-09 14:04:38
if isNothing squares
Jenaf 2017-03-09 14:04:40
then Nothing
Jenaf 2017-03-09 14:04:41
else Just $ foo (fromMaybe (error "unreachable") squares)
Koterpillar 2017-03-09 14:04:59
Jenaf: this is fmap foo
inferno-cop 2017-03-09 14:05:00
that can be rewritten!
Welkin 2017-03-09 14:05:12
try to avoid using if-then-else
Welkin 2017-03-09 14:05:21
it is not idiomatic and there are almost always better ways to write it
Koterpillar 2017-03-09 14:05:22
> let foo = (* 2) in fmap foo (Just 3)
lambdabot 2017-03-09 14:05:27
Just 6
Koterpillar 2017-03-09 14:05:31
> let foo = (* 2) in fmap foo Nothing
lambdabot 2017-03-09 14:05:34
Nothing
Welkin 2017-03-09 14:05:34
use pattern matching as much as possible
Welkin 2017-03-09 14:05:41
and higher-order functions
Jenaf 2017-03-09 14:05:48
yeah
drostie 2017-03-09 14:05:59
What I like about $ is that a $ b $ c $ d is equal to a . b . c $ d.
Welkin 2017-03-09 14:06:22
and yes, the Myabe Monad instance
Koterpillar 2017-03-09 14:08:06
functor
stevenxl 2017-03-09 14:18:58
Hi folks. I'm reading Real World Haskell and I have to run ghc -c to compile a source file to object code.
stevenxl 2017-03-09 14:19:00
Those directions seem to be out of date
stevenxl 2017-03-09 14:19:00
What should I replace them with?
ezyang 2017-03-09 14:19:00
what's the full snippet? ghc -c still works
dunx 2017-03-09 14:19:02
stevenxl: man ghc
dunx 2017-03-09 14:19:13
iirc -c works tho
dunx 2017-03-09 14:19:23
did for me last time i was writing progs in haskell
mbw 2017-03-09 14:19:34
stevenxl: Generally, the comments you can find on the online version of the books are very helpful.
mbw 2017-03-09 14:19:41
*book
inferno-cop 2017-03-09 14:20:06
ghc -c works for me, just tested it
mbw 2017-03-09 14:20:17
Most of the issues which arise from RWH being dated are adressed there.
stevenxl 2017-03-09 14:20:33
mbw: online version you say?
Jenaf 2017-03-09 14:20:37
I'm going to bed
Jenaf 2017-03-09 14:20:45
see you later space cowboys
stevenxl 2017-03-09 14:20:52
inferno-cop: weird. I am using stack so running `stack ghc -c Source.hs`
mbw 2017-03-09 14:20:57
http://book.realworldhaskell.org/read/
inferno-cop 2017-03-09 14:21:19
stevenxl: Ah, stack. I didn't try that
stevenxl 2017-03-09 14:21:47
mbw: thank you!
stevenxl 2017-03-09 14:21:56
inferno-cop: do I have the wrong program installed?
stevenxl 2017-03-09 14:22:32
I see the -c option in `man ghc`. Stop after generating object file.
mbw 2017-03-09 14:22:33
What are you using the object files for? I don't remember this from reading the book.
stevenxl 2017-03-09 14:23:11
http://book.realworldhaskell.org/read/writing-a-library-working-with-json-data.html
stevenxl 2017-03-09 14:23:29
mbw: the module is not set up to correctly generate an executable. missing the main function, etc.
stevenxl 2017-03-09 14:23:37
i think i'm just going to brew install ghc and take it from there
mbw 2017-03-09 14:34:35
sshine: I think you need guard from Control.Monad.
sshine 2017-03-09 14:35:27
teto, did you find http://stackoverflow.com/questions/8748660/is-there-a-better-way-to-write-a-string-contains-x-method ?
sshine 2017-03-09 14:35:49
mbw, cool, thanks.
teto 2017-03-09 14:36:53
sshine: I had found others but this one looks better thanks !

#haskell channel featuring pacak, inferno-cop, michalrus, nilof, Jenaf, Welkin, and 7 others.

Ptival 2017-03-09 13:04:45
is there a known trick to deal with a state monad where certain parts of the code should only have read-only access to certain parts of the state?
Ptival 2017-03-09 13:04:58
seems lens-y
jle` 2017-03-09 13:05:10
Ptival: there's a common readOnly pattern
michalrus 2017-03-09 13:05:16
jle`: so that's what glguy suggested, also. (: I'll look into that, looks much more interesting than IoRef. Thank you, to both of you!
jle` 2017-03-09 13:05:17
readOnly :: Reader s a -> State s a
jle` 2017-03-09 13:05:48
and you can use 'zoom' on the result
glguy 2017-03-09 13:18:19
Ptival: Just pick an 'm' that has the behavior you want
robkennedy 2017-03-09 13:20:28
@djinn (x -> Maybe a) -> (x -> Maybe b) -> x -> Maybe (a,b)
lambdabot 2017-03-09 13:20:28
f a b c =
lambdabot 2017-03-09 13:20:28
case b c of
lambdabot 2017-03-09 13:20:28
Nothing -> Nothing
lambdabot 2017-03-09 13:20:28
Just d -> case a c of
lambdabot 2017-03-09 13:20:28
Nothing -> Nothing
lambdabot 2017-03-09 13:20:30
Just e -> Just (e, d)
glguy 2017-03-09 13:20:43
robkennedy: You can play with lambdabot in /msg
robkennedy 2017-03-09 13:21:42
Sorry. Apart from the distraction: do you know the status of DPH?
nilof 2017-03-09 13:32:29
What alternative preludes are the most used?
Welkin 2017-03-09 13:32:53
I think most people don't bother with any prelude
Welkin 2017-03-09 13:33:11
I've used classy-prelude in the past, but it is overly complex
Welkin 2017-03-09 13:33:41
all the prelude does it re-export other modules
Welkin 2017-03-09 13:33:46
is*
Jenaf 2017-03-09 13:34:16
Hi there! I'm beeing stupid right now
Jenaf 2017-03-09 13:34:35
whats the equivalent to "map" for Data.Sequence
Welkin 2017-03-09 13:34:36
is that a bee joke?
Welkin 2017-03-09 13:34:43
Jenaf: fmap
Welkin 2017-03-09 13:34:47
fmap is the generic map
Welkin 2017-03-09 13:34:48
:t fmap
lambdabot 2017-03-09 13:34:51
Functor f => (a -> b) -> f a -> f b
Jenaf 2017-03-09 13:35:09
okay, do i need to import it from traversable or so?
Koterpillar 2017-03-09 13:36:35
it is in Prelude
`Guest03 2017-03-09 13:36:57
omg
`Guest03 2017-03-09 13:37:31
why don't modules export specialized functions with standard names?
`Guest03 2017-03-09 13:37:37
like map in this case
Welkin 2017-03-09 13:37:46
?
Welkin 2017-03-09 13:37:55
fmap is the standard...
`Guest03 2017-03-09 13:37:59
map is too
Welkin 2017-03-09 13:38:02
map is the weird one that is specialized to List
`Guest03 2017-03-09 13:38:21
Data.Sequence.map would be specialized to Seq
inferno-cop 2017-03-09 13:38:25
Welkin: Does map only exist for historical reasons?
Welkin 2017-03-09 13:38:30
yes
Welkin 2017-03-09 13:38:41
fmap is what you want
`Guest03 2017-03-09 13:38:42
maybe i like to use specialized functions
`Guest03 2017-03-09 13:38:52
for extra type robustness
`Guest03 2017-03-09 13:38:55
or whatever
`Guest03 2017-03-09 13:39:04
is it so hard?
Welkin 2017-03-09 13:39:18
I assume that the 'f' stands for "Functor", as in, "functor map"
pacak 2017-03-09 13:39:22
`Guest03: Specialized functions are actually worse
pacak 2017-03-09 13:39:40
For example
pacak 2017-03-09 13:39:41
:t id
lambdabot 2017-03-09 13:39:44
a -> a
pacak 2017-03-09 13:39:56
There's only one implementation (ignoring bottoms)
pacak 2017-03-09 13:40:01
But for
pacak 2017-03-09 13:40:09
:t id (Int -> Int)
Welkin 2017-03-09 13:40:11
I have felt the pain of using specialized functions for everything when using Elm
lambdabot 2017-03-09 13:40:12
error:
lambdabot 2017-03-09 13:40:12
Pattern syntax in expression context: Int -> Int
lambdabot 2017-03-09 13:40:12
Did you mean to enable TypeApplications?
Welkin 2017-03-09 13:40:14
it sucks
pacak 2017-03-09 13:40:21
there are a whole bunch of versions
Welkin 2017-03-09 13:40:23
you have to explictly import and qualify *everything*
`Guest03 2017-03-09 13:40:28
oh well
pacak 2017-03-09 13:40:41
:t map
pacak 2017-03-09 13:40:44
:t fmap
lambdabot 2017-03-09 13:40:44
(a -> b) -> [a] -> [b]
lambdabot 2017-03-09 13:40:46
Functor f => (a -> b) -> f a -> f b
Koterpillar 2017-03-09 13:40:56
`Guest03: Elm does that, and it's a pain
`Guest03 2017-03-09 13:41:04
anyway map not only carries that, but also promise that it won't reorder and duplicate elements
pacak 2017-03-09 13:41:09
function with map's type signature can change the shape, fmap - does not.
pacak 2017-03-09 13:41:22
Not in the type signature
Welkin 2017-03-09 13:41:39
@src map
lambdabot 2017-03-09 13:41:39
map _ [] = []
lambdabot 2017-03-09 13:41:39
map f (x:xs) = f x : map f xs
Welkin 2017-03-09 13:41:43
wrong one
inferno-cop 2017-03-09 13:41:45
I think it's bad enough that there aren't general versions of collection functions like (!), insert etc
Welkin 2017-03-09 13:41:48
map is actually defined using fmap
Welkin 2017-03-09 13:41:54
so, it gives you no benefits whatsoever
Welkin 2017-03-09 13:42:34
! is only used for Vector, !! for List
Welkin 2017-03-09 13:42:42
!! is almost never used for any reason
`Guest03 2017-03-09 13:42:44
Welkin: what should i use: singleton or return?
Welkin 2017-03-09 13:42:52
because List indexing is slow
Koterpillar 2017-03-09 13:42:55
`Guest03: there's another choice, pure
Welkin 2017-03-09 13:43:00
use pure o.o
`Guest03 2017-03-09 13:43:05
or pure
`Guest03 2017-03-09 13:43:09
are you sure?
Welkin 2017-03-09 13:43:16
unless you want to be explicit and use Map.singleton
`Guest03 2017-03-09 13:43:19
what if we are deep down in layers of Applicative?
inferno-cop 2017-03-09 13:43:19
But I mean, you have Data.Map.! and Data.Array.! for example
Welkin 2017-03-09 13:43:21
that's fine
inferno-cop 2017-03-09 13:43:39
And you have to qualify them if you've got both in scope (I think?)
Welkin 2017-03-09 13:43:59
you have to qualify Vector, Array, etc almost every time anyway
Welkin 2017-03-09 13:44:06
because they share similar apis with List
Welkin 2017-03-09 13:44:10
at least Vector does
`Guest03 2017-03-09 13:44:17
Welkin: that would be V., A., ...
Welkin 2017-03-09 13:44:23
yes
Welkin 2017-03-09 13:44:30
I am not sure what your point is
inferno-cop 2017-03-09 13:44:36
Yeah, why can't we just have a Indexable typeclass or something, so we don't have to qualify
`Guest03 2017-03-09 13:44:46
i want to be explicit when i want
Welkin 2017-03-09 13:45:01
fmap comes from the Functor typeclass
`Guest03 2017-03-09 13:45:02
specialized = explicit
`Guest03 2017-03-09 13:45:42
abot the type
Welkin 2017-03-09 13:45:52
! does not have a typeclass
`Guest03 2017-03-09 13:45:52
by the way
`Guest03 2017-03-09 13:45:52
why the names ! and !! were chosen?
inferno-cop 2017-03-09 13:45:53
It doesn't, but I am saying the world may be a better place if it had a typeclass

#haskell channel featuring monochrom, `Guest03, maerwald, benzrf, frontendloader, jle`, and 5 others.

frontendloader 2017-03-09 11:49:45
kuribas: "The compiler is your debugger" - #haskell
kuribas 2017-03-09 11:49:55
it sucks
ezyang 2017-03-09 11:50:32
invest in your logging infra
kuribas 2017-03-09 11:51:57
I have a long list of data representing bezier curves, it's giving me a headache...
monochrom 2017-03-09 11:52:03
frontendloader, I have seen in the past few days that kuribas's debugging need exceeds what type-checking can do.
frontendloader 2017-03-09 11:52:03
I agree with him, being able to step through/inspect code is how I learn/progress primarily
benzrf 2017-03-09 11:52:06
i debug using the repl
kuribas 2017-03-09 11:52:07
monochrom: yeah, it's numerical code.
kuribas 2017-03-09 11:53:01
monochrom: on the other hand I am abusing Data.Set, so it may be my fault...
monochrom 2017-03-09 11:53:32
I can't imagine how Data.Set could possibly be abused...
kuribas 2017-03-09 11:53:53
monochrom: I have an ordering of curves, which implies they don't touch.
kuribas 2017-03-09 11:54:13
monochrom: so I am using Data.Set as a binary tree
kuribas 2017-03-09 11:55:15
maybe debugging numerical code is just hard in general...
monochrom 2017-03-09 11:55:54
Ah, maybe you don't really have a total order. Yeah that could be abuse, but still not always.
kuribas 2017-03-09 11:56:14
monochrom: it's total as long as the invariant holds.
monochrom 2017-03-09 11:57:01
Hmm. Debug the invariant? :)
kuribas 2017-03-09 11:57:35
yeah, I have many assertions now
`Guest03 2017-03-09 11:58:49
how to poke an array efficiently?
`Guest03 2017-03-09 11:59:02
array comes from a list
`Guest03 2017-03-09 11:59:07
so, poke a list
`Guest03 2017-03-09 11:59:20
into adjacent locations as array
monochrom 2017-03-09 11:59:32
There is no efficient way for lists. Use a real array.
`Guest03 2017-03-09 11:59:51
oh, a question i wanted to ask
`Guest03 2017-03-09 12:00:38
if i write: arr = ByteString.pack [0, 1, 2, 3, 4]
monochrom 2017-03-09 12:01:49
Most array libraries have a "fromList" function or such for dumping a list into an array.
`Guest03 2017-03-09 12:01:54
as top-level definition
`Guest03 2017-03-09 12:03:30
what will it do at compile time and runtime?
monochrom 2017-03-09 12:05:01
Compile time will preserve that expression. Run time will do the conversion at most once, then memoize.
`Guest03 2017-03-09 12:05:01
monochrom: can i get it to convert it at compile time without TemplateHaskell?
monochrom 2017-03-09 12:05:01
No.
`Guest03 2017-03-09 12:05:01
i want that
monochrom 2017-03-09 12:05:01
Yes. Write a GHC plugin.
kuribas 2017-03-09 12:05:01
doesn't ghc unroll short expressions?
monochrom 2017-03-09 12:05:01
5 hours of template haskell can be saved by 5 months of GHC plugin.
monochrom 2017-03-09 12:05:01
FSVO "short"
monochrom 2017-03-09 12:05:01
Pretty sure "x :: Int; x = 1+1" is compile-time simplified.
`Guest03 2017-03-09 12:05:01
can we have it in future
AWizzArd 2017-03-09 12:05:01
System.Random.MWC – is it possible to use this to select a random item out of a list?
glguy 2017-03-09 12:05:13
and when we don't the future is a blur to you?
maerwald 2017-03-09 12:05:22
exactly
`Guest03 2017-03-09 12:33:36
i'm pleasantly surprised with highlevelness of some binding libraries
michalrus 2017-03-09 12:33:43
Hey! Quick (silly?) question: I have a list of functions, say, [a -> Maybe b], but I would also want each of them to have access to its own state — each state being of different type, unknown/transparent to the call site using this list. What would be the best way to approach this?
glguy 2017-03-09 12:34:16
What's state?
`Guest03 2017-03-09 12:34:17
you could think it would have ugly low-level types which need conversion every time, but no
monochrom 2017-03-09 12:34:26
There is no "state".
`Guest03 2017-03-09 12:34:52
not all types are high-level, but most are
jle` 2017-03-09 12:34:59
michalrus: well, each function can have its own closure
`Guest03 2017-03-09 12:35:18
shaderSource :: Shader -> StateVar [String] -- how cool, native strings.
jle` 2017-03-09 12:35:19
but by state, do you mean some sort of environment?
michalrus 2017-03-09 12:35:43
Yes, yes, I'm aware of that. :) Let's say the signature is [s -> a -> (s, Maybe b)], and state is s.
jle` 2017-03-09 12:35:50
for addN n = (\x -> x + n), n is a part of the colsure/'state' of 'addN 10'
michalrus 2017-03-09 12:35:53
How can I have different s for each function?
jle` 2017-03-09 12:36:48
michalrus: what are you planning on doing with this list?
michalrus 2017-03-09 12:43:27
Haha, OK. I'll explain it more widely.
jle` 2017-03-09 12:44:28
there's something you might be able to do with the 'auto' library that might let you do exactly what you described, but i'm not sure if you really want what you're asking for
jle` 2017-03-09 12:45:56
but the `Auto' a b` type represents an `(s -> a -> (b, s))` function paired with an initial state 's'

#haskell channel featuring lambdabot, tapirus, monochrom, kuribas, maerwald, jle`,

nitrix 2017-03-09 10:48:38
Actually X * Y > Z makes no sense, unless I don't have a tree with a single root, but a directed graph instead.
jle` 2017-03-09 10:48:55
what are you calling X, Y, and Z here?
tapirus 2017-03-09 10:48:56
jle`: yeah sorry, I just wrote that zipWith statement but that's not what I really meant...I get the right answer now, but for a moment, I was expecting that if I took some arbitrary array, say x, and compared it with (repeat n), then the result would be the same as (compare x (replicate (length x) y)
nitrix 2017-03-09 10:49:23
This is starting to look like a neural network. Let me think a little and ask a better question.
jle` 2017-03-09 10:49:41
tapirus: ah
jle` 2017-03-09 10:49:45
tapirus: how would you even implement that?
jle` 2017-03-09 10:50:08
you can't test if a list was created with 'repeat' or not
kuribas 2017-03-09 11:25:12
> let (+) = (-) in 1 + 1
lambdabot 2017-03-09 11:25:15
0
glguy 2017-03-09 11:26:46
monochrom: Which thread?
monochrom 2017-03-09 11:27:01
To [] or not to []
Ariakenom 2017-03-09 11:27:32
> let (+) = (*) in 2+2
lambdabot 2017-03-09 11:27:36
4
monochrom 2017-03-09 11:28:05
So the original poster wrote statement of the form "if you use list for , your program is wrong"
monochrom 2017-03-09 11:28:31
And I think "your program is wrong" is a hyperbole and we should take it as such, rather than arguing semantics.
maerwald 2017-03-09 11:28:51
you're deliberately misinterpreting what he said I think
monochrom 2017-03-09 11:29:07
But Richard O'Keefe did decide to argue semantics. "This is an abuse of the word 'wrong'"
maerwald 2017-03-09 11:29:54
but I realize this sort of nitpicking is very characteristic to the haskell community
maerwald 2017-03-09 11:30:22
and ofc can be fun at times
monochrom 2017-03-09 11:30:30
maerwald, I did not nitpick, O'Keefe did.
monochrom 2017-03-09 11:30:51
Or rather, since O'Keefe felt like nitpicking, I would nitpick the nitpicker.
maerwald 2017-03-09 11:30:56
xD
jmcarthur 2017-03-09 11:32:48
Is this metanitpicking?
maerwald 2017-03-09 11:32:53
haha
monochrom 2017-03-09 11:33:31
No, this is reductio ad absurdum
kuribas 2017-03-09 11:41:22
we call it fucking ants
kuribas 2017-03-09 11:41:22
mierenneuken

#haskell channel featuring Aruro, Theophane, geekosaur, kuribas, maerwald, dolio, and 16 others.

cdornan 2017-03-09 09:46:49
Profpatsch: the idea with reflex is that it should become the goto API for regex-base, the defacto regex framework for these last 10 years, so it is logical at least
ezyang 2017-03-09 09:47:49
"reflex" haha
cdornan 2017-03-09 09:49:04
How about turning that around -- could be good that there is a serious effort to produce a definitive regex package
Cale 2017-03-09 09:50:02
cdornan: Wait, someone is naming a regex-related package "reflex"?
Cale 2017-03-09 09:50:13
~trademark issues~
cdornan 2017-03-09 09:50:17
ezyang: I have cut down deps on library and added escape functions
blackdog 2017-03-09 09:50:38
that's gonna be kinda confusing
cdornan 2017-03-09 09:50:59
Noooo -- that was my autocorrector
Cale 2017-03-09 09:51:10
ah, good
cdornan 2017-03-09 09:51:38
Package is called "regex"
geekosaur 2017-03-09 09:51:53
someone fatfingered "refex" at a guess. they must be borrowing my fingers :p
cdornan 2017-03-09 09:52:30
Fat autocorrector!
dolio 2017-03-09 09:52:37
You need really fat fingers to hit l when trying to hit f.
Cale 2017-03-09 09:52:39
Well, the main reason that regex-base hadn't seen any love is because Haskell programmers mostly don't use regexes for anything
maerwald 2017-03-09 09:52:55
they should
johnw 2017-03-09 09:52:57
although, they probably would, if they were asy to use
Cale 2017-03-09 09:52:58
(apart from via other tools, like text editors and sed)
geekosaur 2017-03-09 09:52:59
neh, they typoed regex as refex and autoincorrect added the l to get a word
johnw 2017-03-09 09:53:19
spending 30 mins trying to figure out regexps in Haskell usually leads people to Parsec as a simpler alternative
cdornan 2017-03-09 09:53:29
I agree -- a mistake , as I say in my blog post
Cale 2017-03-09 09:53:31
I can imagine some use cases where you'd want *actual* regular expressions, for performance reasons
geekosaur 2017-03-09 09:53:38
althogh re regex, see recent -cafe message
Cale 2017-03-09 09:53:39
(due to the ability to compile to DFAs)
maerwald 2017-03-09 09:53:43
Cale: no, for complexity reasons
Cale 2017-03-09 09:53:50
Yes
maerwald 2017-03-09 09:53:53
don't make your recognizer more complex than your input language
maerwald 2017-03-09 09:54:00
that's a security principle, not a performance thing
geekosaur 2017-03-09 09:55:34
I have snarked here about the Text.Regex interface being intended to push people as far away from regexes as possible
Cale 2017-03-09 09:57:01
Well, parser combinator based parsers aren't necessarily of higher complexity anyway
johnw 2017-03-09 09:58:20
I remember as a young Haskeller reaching for regexs, only to pull back a bloody stump
maerwald 2017-03-09 09:58:20
computationally yes
johnw 2017-03-09 09:58:20
and the problem is, even when you've figured out the interface, they don't really get any easier to use
Cale 2017-03-09 09:58:20
Yeah, regex-base is terrible, and if someone really needs regular expressions, they should probably build something else.
muesli4 2017-03-09 09:58:20
tapirus: My solution was actually wrong, am I correct that you want something like this? http://codepad.org/xVRPCH2t
ezyang 2017-03-09 09:58:20
I don't understand why we don't just have regular expression combinators
geekosaur 2017-03-09 09:58:20
regex-applicative?
ezyang 2017-03-09 09:58:21
people complain all the time about regexes being unreadable
ezyang 2017-03-09 09:58:21
sure :)
johnw 2017-03-09 09:58:21
I like regex-applicative for building up complex regex expressions
geekosaur 2017-03-09 09:58:21
also, the counternark to Text.Regex is how often we get someone who first asks how to use it, then asks what regex they want...
cdornan 2017-03-09 09:58:21
Was just going to say regex-applicative
johnw 2017-03-09 09:58:21
so says ^e(dward)z\.?yang$
geekosaur 2017-03-09 09:58:21
which *ought* to be a hint that maybe reaching for regex is not the right answer
maerwald 2017-03-09 09:58:21
the demonization of regular expressions in the haskell community is a consequence of the fact that parser combinators are more elegant to do in haskell
muesli4 2017-03-09 09:58:21
tapirus: Basically, when the suffix stays below a reference value it is seen as lower (above -> higher, on the reference value -> equal).
cdornan 2017-03-09 09:58:53
All true but not having conventional high quality regex API is not good in my experience
hexagoxel 2017-03-09 09:58:56
no, the usual notation to express regular expression does not leave room to write comments. this is in contrast with haskell's philosophy of writing extensive documentation for all code.
johnw 2017-03-09 09:58:57
Cale: and in the Perl scripts I use to patch the results of Coq's unverified extractor, thus resulting in complete confidence
Cale 2017-03-09 09:59:03
lol
Cale 2017-03-09 09:59:27
hexagoxel: lol
Aruro 2017-03-09 09:59:48
are there many commercial standalone haskell apps ? beside hledger and haskell studio for mac ?
maerwald 2017-03-09 09:59:50
johnw: I don't understand. error messages in parser combinators are rarely clear
Cale 2017-03-09 10:00:05
Aruro: Do they also have to be open source?
maerwald 2017-03-09 10:00:08
ofc, depends on the library
johnw 2017-03-09 10:00:26
maerwald: that exactly my point; they are less clear the more general the combinators
Aruro 2017-03-09 10:01:04
Cale: no, just haskell
Aruro 2017-03-09 10:01:15
only requirement it has to be an "app" not "We are doing consulting"
ezyang 2017-03-09 10:01:28
to me, the bigger problem with string regexes is lack of compositionality
Cale 2017-03-09 10:03:12
Most money is in web development these days
blackdog 2017-03-09 10:03:16
do you mean SaaS stuff?
johnw 2017-03-09 10:03:19
the best feature of regexs is how much they can liven up any IRC channel
johnw 2017-03-09 10:03:42
Cale: you'd think the Web would have been fully developed by now
Cale 2017-03-09 10:03:49
haha
blackdog 2017-03-09 10:03:56
johnw: think growth as in cancer
Cale 2017-03-09 10:03:57
Well, we're working on it
Aruro 2017-03-09 10:04:13
like even commercial modeling software, or even SaaS buiseness applications
Cale 2017-03-09 10:04:14
Hopefully we can get things to a place where it's not such a big effort
blackdog 2017-03-09 10:04:26
Aruro: sure. betterteam.com is in haskell.
blackdog 2017-03-09 10:04:33
the point is, you wouldn't know unless somebody told you.
Aruro 2017-03-09 10:05:11
i mean what stops developers to use haskell for end user programs?
Aruro 2017-03-09 10:05:22
excluding - cloud,services and such
Xe 2017-03-09 10:05:26
Aruro: managers
Cale 2017-03-09 10:05:29
Aruro: Almost nobody sells those at all?
Aruro 2017-03-09 10:05:45
why? i bout ntfs driver for mac from paragon, seems ok.
Aruro 2017-03-09 10:05:51
bought*
Cale 2017-03-09 10:06:26
I guess on Mac, there are some things which inexplicably cost money but which would ordinarily be part of your OS
geekosaur 2017-03-09 10:06:59
r/o ntfs driver is built in, later releases have a hidden partial r/w support option
blackdog 2017-03-09 10:07:17
it's just way easier to make money by putting your code on a server, rather than dealing with licensing etc.
Aruro 2017-03-09 10:07:46
so licensing is one of the issues?
dolio 2017-03-09 10:08:03
It's an issue with writing software.
geekosaur 2017-03-09 10:08:04
this isn;t so inexplicable because r/w ntfs info used to require microsoft nda. linux emulated it via an ugly hack (which basically meant do stuff and let ntfs journaling sort it out on the next windows boot. yes, this worked about as well as you could expect)
kuribas 2017-03-09 10:09:43
blackdog: GUI's support isn't the best in haskell.
ongy 2017-03-09 10:10:08
I'd say the haskell ecosystem makes it annoying to distribute licensed software, since dependencies have licenses all over the place and nobody cares
Aruro 2017-03-09 10:10:46
take alphasheets, their task is perfect for an app, but it will be webservice ? they do have some haskell coding there
kuribas 2017-03-09 10:10:51
ongy: most haskell libraries are BSD.
ongy 2017-03-09 10:10:56
I have seen a package (some library bindings) that has a conflicting license to the library. Which the author explicitly states
maerwald 2017-03-09 10:11:03
unfortunately
ongy 2017-03-09 10:11:06
kuribas: except for the (l)gpl ones
Cale 2017-03-09 10:11:07
ongy: Which package?
ongy 2017-03-09 10:11:19
I don't remember which one. I don't think I ended up using it
Cale 2017-03-09 10:11:36
Note that you can distribute BSD bindings to a GPL library, so long as you don't distribute the GPLed library with it.
dolio 2017-03-09 10:11:37
The majority of programmers don't care about licenses, regardless of which language they use.
maerwald 2017-03-09 10:11:38
people just seem to use what random thing "cabal init" suggests (which is BSD-3 afair)
maerwald 2017-03-09 10:11:48
and that's a pity
Theophane 2017-03-09 10:12:36
`stack legal` could be very useful ;)
ongy 2017-03-09 10:13:11
Cale: it was something like this. But it's a bit more annoying if someone intended to distribute it the usual windows way with libraries included
Cale 2017-03-09 10:13:11
Whatever you're making bindings to might as well be proprietary from your perspective if you're not distributing the code.
Theophane 2017-03-09 10:13:11
(or `cabal legal`)
Cale 2017-03-09 10:13:11
ongy: That's true.
kuribas 2017-03-09 10:13:11
ongy: how is that different from any other language?
Xe 2017-03-09 10:13:20
kuribas: unlike php you don't need to dencrypt your source code at runtime
Xe 2017-03-09 10:13:32
(such monsters do exist in this world)
ongy 2017-03-09 10:13:37
kuribas: I have seen *less* of that in the C(++) ecosystem. But maybe I just cared less
ongy 2017-03-09 10:14:04
it's not language specific, but I feel like nobody cares. because for the main usecase (user downloads from hackage/stackage and builds/links themself) it doesn't matter
jle` 2017-03-09 10:14:06
huh didn't realize that hackagebot has been gone for over three months now
jle` 2017-03-09 10:14:15
i'll miss that little bot
jle` 2017-03-09 10:14:22
rest in peace hackagebot
ongy 2017-03-09 10:14:32
but if someone wanted to use it commercially and distribute binaries with *batteries included* (or for windows) things get hairy
maerwald 2017-03-09 10:14:54
why?
Aruro 2017-03-09 10:15:02
even for support scheme? like donate and spport me?
maerwald 2017-03-09 10:15:19
ongy: why would that be a problem?
Cale 2017-03-09 10:15:55
Well, ongy has a point -- the fact that you can't figure out from the license on the Haskell binding what to do about the library it's a binding to might be a bit annoying if you have a ton of dependencies to go through.
Cale 2017-03-09 10:16:17
But I dunno, packaging stuff for Windows already seems like a pain.
Aruro 2017-03-09 10:16:30
linux users have money too
Aruro 2017-03-09 10:16:32
:)
Aruro 2017-03-09 10:16:49
question is where is haskell monetization ecosystem? even in form of donations
Cale 2017-03-09 10:17:24
It comes from various startups and other companies who pay us to build reliable software
blackdog 2017-03-09 10:17:26
kuribas: yeah, that's what i meant - we haven't concentrated behind a single framework or approach, so no single codebase gets the work.
blackdog 2017-03-09 10:18:10
(which isn't a criticism, it's just not obvious what the best way forward is, and bluntly without a large base of people writing gui software nobody's that interested)
kuribas 2017-03-09 10:18:41
blackdog: I think it's more of a lack of interest in GUI code in general.
ongy 2017-03-09 10:18:41
maerwald: I have no example, but if there was a package that depended on another one and they have incompatible licenses, distributing binaries wouldn't be possible to my understanding
blackdog 2017-03-09 10:18:41
Aruro: i tend to think the easiest path is just writing fast, safe web apps.
maerwald 2017-03-09 10:18:43
ongy: probably, I just didn't understand what "commercially" has to do with that
ongy 2017-03-09 10:19:17
maerwald: most others don't give a damn, or just put it on hackage aswell and don't distribute binaries
kuribas 2017-03-09 10:19:38
blackdog: maybe because people think pure functional isn't a good much for the imperative nature of GUIs?
ongy 2017-03-09 10:19:50
blackdog: I think you can drop both fast and safe there....
ongy 2017-03-09 10:20:13
Aruro: I don't think there's any monetization options on hackage (or anywhere) maybe some people have donation buttons on their project websites
Aruro 2017-03-09 10:20:38
yeah, hledger has, would be interesting to hear his feedback
ongy 2017-03-09 10:20:43
if I ever get a userbase that's bigger than the people I know, I may put something up aswell
blackdog 2017-03-09 10:21:37
ongy: why?
blackdog 2017-03-09 10:21:57
i mean, just by default you're going to have faster safer code than your average rubyist.
blackdog 2017-03-09 10:22:08
(i know this because i am a very average rubyist)
ongy 2017-03-09 10:22:10
have you seen the web? I doesn't look like safe and fast are a requirement these days. It's good to have, but...
ystael 2017-03-09 10:22:45
ongy: distinguish "requirement for running a business" from "requirement for making something you would actually want to work on" :)
ongy 2017-03-09 10:22:53
oh and I'm mixing safe and secure again. But still applies even for safe
ongy 2017-03-09 10:23:09
ystael: The starting question was about the money :)
ystael 2017-03-09 10:23:35
oh, yes, I see
Aruro 2017-03-09 10:23:47
about economy of haskell codebase
Aruro 2017-03-09 10:23:58
money support/motivation
Aruro 2017-03-09 10:24:25
hledger is not distributed on windows, so windows pain seems real.
maerwald 2017-03-09 10:25:24
it's ok to not support windows
maerwald 2017-03-09 10:25:41
it's an unethical operating system, taking away pretty much all user freedoms
ongy 2017-03-09 10:25:44
for GHC there's a few people that are payed by companies. Microsoft research for example
ystael 2017-03-09 10:25:59
Is it OK to advertise jobs in here?
ongy 2017-03-09 10:27:13
people do from time to time. But IRC may not be the best platform to do so (volatile, and with a fast-ish channel like this not many people will see it)
ezyang 2017-03-09 10:28:26
cdornan: You mispelled regex as reflex on Reddit too :P
cdornan 2017-03-09 10:30:02
ezyang: Corrected -- thanks!
tapirus 2017-03-09 10:41:47
why does compare [EQ] (repeat EQ) return LT?
jle` 2017-03-09 10:41:47
> "hi" < "hill"
lambdabot 2017-03-09 10:41:47
True
jle` 2017-03-09 10:41:47
it's dictionary ordering
jle` 2017-03-09 10:41:47
would "hi" or "hill" come first in a dictionary?
blackdog 2017-03-09 10:41:47
i guess that's the same question as compare [] (repeat EQ), really.
tapirus 2017-03-09 10:41:47
hmm
blackdog 2017-03-09 10:42:35
wait, jle` 's explanation is better, ignore me
tapirus 2017-03-09 10:42:35
I guess intuitvely I expected it to behave as zipWith (compare) [EQ] (repeat EQ)
glguy 2017-03-09 10:42:35
jle`: How heavy do you suppose this dictionary containing infinitely long words would be?
jle` 2017-03-09 10:42:35
so it should return an [Ordering] ?
tapirus 2017-03-09 10:42:35
but yeah, I get jle`s's explanation
jle` 2017-03-09 10:42:42
:t compare
lambdabot 2017-03-09 10:42:44
Ord a => a -> a -> Ordering
monochrom 2017-03-09 10:42:45
Intuition is fantasy.
jle` 2017-03-09 10:42:52
compare returns an Ordering, not an 'a'
jle` 2017-03-09 10:44:23
tapirus: what would you have expected the answer to be?
nitrix 2017-03-09 10:46:31
Can someone with a reasonable understanding of decision trees (used as classifiers) kind of breif me on the minimal operations (decisions) the tree needs to support to perform its classification work?
nitrix 2017-03-09 10:46:54
The inputs are doubles in the range [0, 1]. I'm guessing X > Y and X * Y > Z ?
nitrix 2017-03-09 10:46:57
Is this the most minimal?