robertkennedy 2017-03-02 01:51:06
Is there anyway in ghci to evaluate type functions?
Xnuk 2017-03-02 01:51:25
:t take
lambdabot 2017-03-02 01:51:29
Int -> [a] -> [a]
robertkennedy 2017-03-02 01:52:30
I meant more like `F Char = Int`
ertes 2017-03-02 01:54:14
robertkennedy: :t undefined :: F Char
ertes 2017-03-02 01:54:57
GHCi seems to evaluate at least closed type families and type synonyms
robertkennedy 2017-03-02 01:55:07
Thats the best I got too. Tight, thanks.
ertes 2017-03-02 01:56:20
robertkennedy: you can also guess what it evaluates to and have GHC check whether your guess was correct: () :: (F Char ~ Int) => ()
ertes 2017-03-02 01:56:42
if it was correct, it will just be quiet
ertes 2017-03-02 01:57:18
ah, it does actually print the ()
ertes 2017-03-02 01:57:37
pure () :: (Int ~ Int) => IO ()
fendor 2017-03-02 02:00:19
> foldl (/) 1 [5, 6, 10, 2] :: Expr
lambdabot 2017-03-02 02:00:26
mueval-core: Time limit exceeded
Onemorenickname_ 2017-03-02 02:00:48
ertes, I'm back, I'm making the small example
Onemorenickname_ 2017-03-02 02:07:26
ertes, i'm still making it, but the small example I made was too simple
Onemorenickname_ 2017-03-02 02:10:44
well, the simplest example : a mutually recursive tree trasversal and looking at most one time each node
Onemorenickname_ 2017-03-02 02:10:52
it basically amounts to that
Onemorenickname_ 2017-03-02 02:12:30
a connex graph where a node is represented by its adjacency list
Onemorenickname_ 2017-03-02 02:12:48
with no intermediate representation
ertes 2017-03-02 02:14:25
Onemorenickname_: since i rarely work with graphs, take this with a grain of salt: i would probably name the nodes and keep a set of already visited nodes
ertes 2017-03-02 02:14:50
Onemorenickname_: but a nicer approach might be to use a zipper
Onemorenickname_ 2017-03-02 02:14:59
ertes, the problem is that traversal are not in sync with one an other
Onemorenickname_ 2017-03-02 02:15:11
so i'd have to keep many set of visited nodes at the same time
Onemorenickname_ 2017-03-02 02:15:17
i'm looking online what a zipper is
ertes 2017-03-02 02:15:38
if they are mutually recursive, you can just pass the set around, can't you?
Onemorenickname_ 2017-03-02 02:16:00
the traversals are not in sync
Onemorenickname_ 2017-03-02 02:16:09
but a zipper looks like exactly what i need
Onemorenickname_ 2017-03-02 02:16:27
i'm doing what i'm doing because i don't like the named approach
Onemorenickname_ 2017-03-02 02:16:35
i can have non-addressed names and so on
ertes 2017-03-02 02:16:36
what do you mean by "not in sync"?
ertes 2017-03-02 02:17:05
they handle different parts of the graph?
Onemorenickname_ 2017-03-02 02:17:52
like, traversal A will begin, then stop, then traversal B will begin, then A will continue etc.
Onemorenickname_ 2017-03-02 02:18:12
oh, it's just one more argument and one more output
Onemorenickname_ 2017-03-02 02:18:19
fair enough
ertes 2017-03-02 02:18:21
exactly
ertes 2017-03-02 02:18:37
in fact only one more argument, if they just use each other
Onemorenickname_ 2017-03-02 02:18:44
(they don't)
Onemorenickname_ 2017-03-02 02:18:45
i still don't like the O(N*m) space
Onemorenickname_ 2017-03-02 02:18:49
i'm checking the zipper
Onemorenickname_ 2017-03-02 02:18:54
it sounds very promising
ertes 2017-03-02 02:19:44
Onemorenickname_: in any case you should (at least for the first year or so) drop the notion that values have a fixed memory address, or in fact a memory address at all
ertes 2017-03-02 02:20:05
values might live in your program only implicitly, either because of an optimisation or laziness
ertes 2017-03-02 02:22:24
however, if you *want to*, you can do it the C way… we have explicit allocation and pointers, but they're mostly used for FFI stuff
russellw 2017-03-02 02:23:56
Given a tool like this https://hackage.haskell.org/package/hfmt that says you can install either with Cabal or Stack, which should I use?
Onemorenickname_ 2017-03-02 02:23:56
ertes, i'm trying to find a better way
russellw 2017-03-02 02:24:07
I'm running on Windows, if that makes a difference
Onemorenickname_ 2017-03-02 02:24:09
if i'm in #haskell, at least i can find a not-C way
ertes 2017-03-02 02:33:49
Onemorenickname_: another option could be to design your algorithm such that you can't walk the same path twice by removing the edges during your traversal
ertes 2017-03-02 02:34:10
but i don't know how efficient that would be… you would need to handle dead-ends by backtracking
ertes 2017-03-02 02:34:24
but you're probably doing that anyway
Onemorenickname_ 2017-03-02 02:34:29
actually, it's a parsing algorithm
Onemorenickname_ 2017-03-02 02:34:37
so the graph is an algebraic grammar graph
Onemorenickname_ 2017-03-02 02:34:56
and there /many/ traversals
Onemorenickname_ 2017-03-02 02:35:01
not easy to remove edges :(
ertes 2017-03-02 02:35:09
ah, i see
ertes 2017-03-02 02:35:19
something that can't be done with parser combinators?
Onemorenickname_ 2017-03-02 02:35:55
there are many things
Onemorenickname_ 2017-03-02 02:36:08
i want to be able to plug hooks on partial parsings
Onemorenickname_ 2017-03-02 02:36:19
it will be modified from outside
Onemorenickname_ 2017-03-02 02:36:23
(by user input)
Onemorenickname_ 2017-03-02 02:36:45
and, i want to plug hooks on "character consuption"
ertes 2017-03-02 02:36:50
so the grammer itself changes dynamically in response to concurrent user input?
Onemorenickname_ 2017-03-02 02:36:59
yep
Onemorenickname_ 2017-03-02 02:37:10
(the hooks on character consumption are so I can make optimization based on my knowledge)
ertes 2017-03-02 02:37:23
well, at least megaparsec has a transformer variant, but as far as i see it can't handle incremental input
ertes 2017-03-02 02:37:30
trifecta can handle incremental input, but doesn't have a transformer variant
jnj 2017-03-02 02:37:35
Any thoughts on how to avoid a seemingly "wrong" warning?: http://lpaste.net/353124
Onemorenickname_ 2017-03-02 02:38:04
ertes : basically, i'm making a dynamic language, and I want to provide high level parsing primitives
ertes 2017-03-02 02:38:04
attoparsec is the only combinator library i know that can do both, but it's specialised to efficiently parsing machine-generated stuff
Onemorenickname_ 2017-03-02 02:38:33
i'm willing to use any language to make, hence my presence here
ertes 2017-03-02 02:38:53
Onemorenickname_: i would probably create a combinator library
merijn 2017-03-02 02:38:55
ertes: attoparsec doesn't have a transformer variant either, does it?
ertes 2017-03-02 02:39:06
merijn: doesn't it? wait
merijn 2017-03-02 02:39:22
ertes: It never has had that
ertes 2017-03-02 02:39:31
crap, you're right
ertes 2017-03-02 02:39:51
yeah, custom combinator library then
Onemorenickname_ 2017-03-02 02:41:27
ha ha
Onemorenickname_ 2017-03-02 02:41:59
1500 on #haskell, niice
mbw 2017-03-02 02:44:33
Hello everybody, I have a question regarding desugaring list comprehensions. If you take a naive matmul implementation with: dotProd v w = sum (zipWith (*) v w); matmul a b = [ map (dotProd row) (Data.List.transpose b) | row <- a ], is it possible to express this using nested do notation?