bitonic 2017-02-08 23:45:21
merijn: ah yes, add an evaluate
bitonic 2017-02-08 23:46:16
I was sort of joking anyway, I don't think that's a good idea unless you're in trouble
merijn 2017-02-08 23:47:13
bitonic: Yes, I'm trying to figure out a more reasonable solution...
Profpatsch 2017-02-08 23:48:09
Is there a way to make sure all fields of a record are used in a function?
merijn 2017-02-08 23:48:31
Profpatsch: Doubt it?
bitonic 2017-02-08 23:48:34
Profpatsch: as a caller?
Profpatsch 2017-02-08 23:49:02
As in data Foo = Foo { a :: Int, b :: Text }
Profpatsch 2017-02-08 23:49:18
foo Foo{..} = show a
Profpatsch 2017-02-08 23:49:30
Warning: field b not used
merijn 2017-02-08 23:49:57
Profpatsch: Well, with -Wall if you don't use wildcards you'd get that warning
merijn 2017-02-08 23:50:08
Profpatsch: But then you don't get a warning for not writing out all fields
Profpatsch 2017-02-08 23:50:41
The problem is if a new field appears (as is often the case in business data)
Profpatsch 2017-02-08 23:50:58
You insert it but don't get a warning in e.g. render functions.
bitonic 2017-02-08 23:51:51
Profpatsch: yeah, sadly you cannot do that. The best you can do is to use normal pattern matching, but that's inconvenient
bitonic 2017-02-08 23:52:18
Since 1. reordering of fields will break your matches 2. you cannot grep uses of the fields
bitonic 2017-02-08 23:52:32
To be fair that's a pretty uncommon features in languages, although I agree with you that it would be useful
nut 2017-02-08 23:53:02
I'm testing with the Snowball library. main = interact (stem English)
Profpatsch 2017-02-08 23:53:13
It would be neat to integrate that into RecordWildCards.
nut 2017-02-08 23:53:19
but I don't get the stemmed word.
Profpatsch 2017-02-08 23:53:29
Maybe as an annotation
nut 2017-02-08 23:53:45
Could anyone take a look?
Profpatsch 2017-02-08 23:53:55
Foo{..{-#CheckFields#-}}
bitonic 2017-02-08 23:54:17
Profpatsch: yeah, it's not a bad idea, although I think a `-f` flag would probably be better
bitonic 2017-02-08 23:54:28
`-fwarn-unused-wildcards` or whatever
merijn 2017-02-08 23:54:30
bitonic: I think I could do this with CtxtIf, but I doubt that dependency will be accepted :\
bitonic 2017-02-08 23:54:58
merijn: so you assume `fromEnum` is total if the type is not an instance of `Bounded`?
Profpatsch 2017-02-08 23:54:59
bitonic: Yeah, but sometimes you want it and sometimes you don't
bitonic 2017-02-08 23:55:02
What is this for?
bitonic 2017-02-08 23:55:06
(to merijn)
bitonic 2017-02-08 23:55:12
Profpatsch: I think I'd want it always
bitonic 2017-02-08 23:55:17
If you're using wildcards, use everything
Profpatsch 2017-02-08 23:55:21
Right!
bitonic 2017-02-08 23:55:22
Otherwise, use NamedRecordPuns
merijn 2017-02-08 23:55:26
bitonic: Trying to write Enum for Data.Monoid.Inf
bitonic 2017-02-08 23:55:29
NamedFieldPuns
Profpatsch 2017-02-08 23:56:16
bitonic: That's so cool, we should create a GHC ticket.
Profpatsch 2017-02-08 23:56:26
I've been wanting that since forever.
bitonic 2017-02-08 23:56:45
merijn: is that a good idea though? I don't know
bitonic 2017-02-08 23:56:51
It'd be a pretty counter-intuitive instance
bitonic 2017-02-08 23:57:17
What would `toEnum (Infinity :: Inf Pos Integer)`?
merijn 2017-02-08 23:57:21
bitonic: Why's that? You just want it to match the existing enum but with Infinity as first (or last) element
bitonic 2017-02-08 23:57:39
merijn: right but I'm not sure how that would work for non-Bounded types
bitonic 2017-02-08 23:57:59
You could always use 0 as \top or \bot
bitonic 2017-02-08 23:58:04
and then bump all the others
merijn 2017-02-08 23:58:16
bitonic: For unbounded types you can never reach Infinity anyway
merijn 2017-02-08 23:58:31
bitonic: For Inf Pos you'd expect Infinity to be the last enum for a bounded value
merijn 2017-02-08 23:58:41
Enum as a class is fucked up anyway
bitonic 2017-02-08 23:58:54
merijn: what I'm saying is that maybe the Bounded constraint is warranted anyway
bitonic 2017-02-08 23:58:55
In this case
merijn 2017-02-08 23:59:02
Since it requires 'fromEnum :: a -> Int' which is silly
merijn 2017-02-08 23:59:34
maybe...
bitonic 2017-02-08 23:59:46
I mean there is nothing wrong with `Inf Pos Integer` anyway
bitonic 2017-02-09 00:00:16
And you can write an `Enum` instance -- jut set `toEnum Infinity = 0`, bump all positives, decrease all negatives
merijn 2017-02-09 00:00:24
Could write fromEnum to do index "enumFrom (toEnum 0) ++ [Infinity]"
bitonic 2017-02-09 00:00:28
But it's an arbitrary choice
merijn 2017-02-09 00:00:42
bitonic: No, that's a silly instance
merijn 2017-02-09 00:01:06
Positive infinity should not be enumerated before actual values
bitonic 2017-02-09 00:01:06
merijn: ah wait, does `Enum` need to respect `Ord`?
merijn 2017-02-09 00:01:18
bitonic: Does it? No. Should it? Yes.
bitonic 2017-02-09 00:02:04
Then I don't think the `Bounded` constraint is overly restrictive. How would you write the instance manually for `Enum (Inf Pos Integer)` anyway?
merijn 2017-02-09 00:03:01
bitonic: Well, isn't that the exact thing I'm complaining about? The fact that Enum is defined in a stupid way
Profpatsch 2017-02-09 00:03:09
Couldn't match type 'Text' with 'HtmlT Identity ()'
merijn 2017-02-09 00:03:10
We should have a different class for bounded and unbounded types
Profpatsch 2017-02-09 00:03:18
Which is the Actual which is the Expected?
Profpatsch 2017-02-09 00:03:28
Those varying error messages are driving me crazy.
bitonic 2017-02-09 00:03:36
merijn: sure, but at least now we have an idea on how to write `Enum` for `Inf`
bitonic 2017-02-09 00:03:51
Profpatsch: it tells you right below "expected type" "actual type"
Profpatsch 2017-02-09 00:04:36
bitonic: Nope, not with functional dependencies.
Profpatsch 2017-02-09 00:04:42
arising from a functional dependency between constraints:
bitonic 2017-02-09 00:05:35
Profpatsch: Okay. Then usually the first one is the expected and the second the actual
bitonic 2017-02-09 00:05:46
But I'm not sure here. I'd just stare at the code and find out what's wrong :P
Profpatsch 2017-02-09 00:07:16
Yeah, since Blaze got lawful Monad implementations recently maybe it's better to switch back. Lucid's extreme overloading is driving me mad.
Profpatsch 2017-02-09 00:07:40
The compiler simply can't generate very good error messages with so much magic going on.
Profpatsch 2017-02-09 00:08:52
Ah, forgot one toHtml
lyndon 2017-02-09 00:11:44
Hey #haskell
lyndon 2017-02-09 00:11:52
In https://hackage.haskell.org/package/network-uri-static-0.1.0.0/docs/src/Network-URI-Static.html#staticURI
lyndon 2017-02-09 00:12:01
What's the deal with the "||" in the quasiquotes?
lyndon 2017-02-09 00:12:24
I can't find any real documentation on it.
bitonic 2017-02-09 00:14:19
lyndon: it's typed template Haskell
lyndon 2017-02-09 00:15:18
!
lyndon 2017-02-09 00:15:57
bitonic: that snuck under my radar
bitonic 2017-02-09 00:16:47
lyndon: ehe. If you grep for [|| in you'll find references to it
lyndon 2017-02-09 00:17:14
And it doesn't even require a language extension besides regular template haskell! Amazing.
merijn 2017-02-09 00:23:32
Typed TH is amazing :)
lyndon 2017-02-09 00:24:42
Btw, how would you modify that source to remove the orphan instances?
lyndon 2017-02-09 00:25:01
Newtype wrappers seem to get in the way of the QuasiQuoter
muzzle 2017-02-09 00:31:39
hi
systadmin 2017-02-09 00:31:45
hello
muzzle 2017-02-09 00:31:55
I have a question about a performance problem in an application for my thesis
muzzle 2017-02-09 00:32:19
the application builds a very large in-memory index (10s of gigabytes)
muzzle 2017-02-09 00:32:24
and uses it for search
systadmin 2017-02-09 00:32:24
?
muzzle 2017-02-09 00:32:33
but it's getting slow with large indices
muzzle 2017-02-09 00:32:37
and certain search settings
muzzle 2017-02-09 00:32:47
and I don't know how to go about pinpointing the problem
muzzle 2017-02-09 00:32:52
memory usage is as expected
muzzle 2017-02-09 00:33:00
but it just takes forever to search
muzzle 2017-02-09 00:33:04
and I can't figure out why
muzzle 2017-02-09 00:33:15
when I profile small examples everything looks OK
muzzle 2017-02-09 00:33:25
but I can't use the profiler on large examples
muzzle 2017-02-09 00:33:29
because it's too slow
muzzle 2017-02-09 00:33:46
does anyone have an idea what I can do here?
quchen 2017-02-09 00:35:17
More details are necessary to answer this question.
quchen 2017-02-09 00:35:24
Like what data structure your index is.
muzzle 2017-02-09 00:35:43
My index is a suffix tree
muzzle 2017-02-09 00:36:07
a very large one
muzzle 2017-02-09 00:36:42
which I use for a string-matching algorithm
muzzle 2017-02-09 00:36:50
which should theoretically be running in similar time
muzzle 2017-02-09 00:37:10
*linear time
muzzle 2017-02-09 00:37:34
and then I do some post-processing on the results
muzzle 2017-02-09 00:39:22
which should again not be terribly slow
muzzle 2017-02-09 00:39:46
the problem is just that I'm completely stumped on what part of the code could be the culprit
muzzle 2017-02-09 00:40:34
and I can't really take measurements with the profiler because building a large index with profiling enabled is just too slow
muzzle 2017-02-09 00:40:54
and so far I was unsucessful at building a small(ish) example with which the problem occurs
muzzle 2017-02-09 00:41:19
So what can I do to find badly performing parts of my source code without profiling?
insitu 2017-02-09 00:44:11
muzzle could it be that you are hitting performance issues because of laziness of your data structure?
insitu 2017-02-09 00:44:47
when index is small, evaluating thunk is fast but when the structure gets very large you incur an increasing penalty