Ptival 2017-01-26 08:45:48
so, right now, I have a datatype: Work t tr r = Todo t (tr -> Work t tr r) | Done r
Ptival 2017-01-26 08:46:21
and I write a function: step :: T -> (TR -> Work T TR R) -> R (for a given T, TR, and R)
Ptival 2017-01-26 08:46:55
(T stands for the task type, TR for the task result type, and R for the final result type)
Ptival 2017-01-26 08:49:04
and a function to perform a step: performStep :: (t -> (tr -> Work t tr r) -> Work t tr r) -> Work t tr r -> Work t tr r
dcoutts 2017-01-26 08:49:30
bitemyapp: seeing it from the other side, I don't recognise that picture at all. It's sad there's such a disconnect. e.g. I frequently see PRs for trivial fixes contributed by newcomers being reviewed and approved within hours
dram_phone 2017-01-26 08:52:17
Ptival: Huge congrats!
dram_phone 2017-01-26 08:52:34
You (basically) invented free monads!
Ptival 2017-01-26 08:52:37
haha
Ptival 2017-01-26 08:52:39
ok...
Ptival 2017-01-26 08:52:45
I guess I should read on them now @__@
dram_phone 2017-01-26 08:53:19
you'll have an entertaining time writing instance Monad (Work t tr)
geekosaur 2017-01-26 08:54:42
fwiw I see a fair amount of cabal dev and discussion (in #hackage). and it seems to me the devs are often as frustrated as some users are... perhaps this means it's time for a rethink. (except new-build may have been the rethink, and backward compat seems to be a big headache there. not to mention having to hack around OS X and Windows inanity)
Ptival 2017-01-26 08:55:25
dram_phone: would my Work type be the "DSL" in this case?
dcoutts 2017-01-26 08:55:41
geekosaur: new-build has been working pretty well I think
geekosaur 2017-01-26 08:56:04
yes, but the path there looks to have involved many dev expletives >.>
dram_phone 2017-01-26 08:56:06
You are already doing a decent DSL here
dram_phone 2017-01-26 08:56:16
You just need a monadic boost
dcoutts 2017-01-26 08:56:19
geekosaur: :-)
dram_phone 2017-01-26 08:57:07
And somehow it's all nicer because you get do-notation, applicatives, and other goodies
dram_phone 2017-01-26 08:57:21
Ptical: ^
dram_phone 2017-01-26 08:58:24
uh
dram_phone 2017-01-26 08:58:29
Ptival: ^
roxxik 2017-01-26 08:59:01
and Iter is there to help you, too
zipper 2017-01-26 09:00:26
Hey, how do you guys use random in monads other than IO ?
roxxik 2017-01-26 09:00:44
`delay :: (Monad f, MonadFree f m) => m a -> m a` let's you stuff something in between your computation steps
zipper 2017-01-26 09:00:54
Like in my case I have a parseJSON that I want to use random but the monad is Parser
roxxik 2017-01-26 09:01:19
but i haven't used, just read the docs :S
geekosaur 2017-01-26 09:01:19
zipper, the only time you need IO is getting an initial seed. after that, any monad that gives you access to state will do to carry the seed around
zipper 2017-01-26 09:01:54
hmmm I see
geekosaur 2017-01-26 09:02:48
there are convenience functions that use a seed in a hidden IORef, but you can use the lower level ones with state (see MonadRandom for a wrapper that iirc can also be used in a monad transformer stack) or write your own wrappers
dram_phone 2017-01-26 09:06:15
Do the IORef ones run faster?
lpaste 2017-01-26 09:06:17
dmwit pasted "why is Cabal outdated?" at http://lpaste.net/8708848608495009792
dmwit 2017-01-26 09:06:45
I can't get `cabal test` to run; it keeps complaining that I should redo the `configure` step, even after I've immediately done that.
dmwit 2017-01-26 09:06:48
Any ideas?
dcoutts 2017-01-26 09:08:06
dmwit: we should probably discuss this on #hackage it's more or less the dev channel for this topic
dmwit 2017-01-26 09:08:17
ok
ertes 2017-01-26 09:08:35
helo
dmwit 2017-01-26 09:08:56
I asked here because it didn't seem like it was necessarily specific to the cabal codebase, but I'm happy to continue there.
buglebudabey 2017-01-26 09:15:27
i'm running my hakyll site and when i rebuild no changes to my site.hs file are recognized, nothing changes about the site. what do?
buglebudabey 2017-01-26 09:15:46
i've run 'stack exec site rebuild' and that doesn't make changes from changes in my site.hs file
sm 2017-01-26 09:16:32
buglebudabey: that's running the compiled "site", but not recompiling it from "site.hs"
sm 2017-01-26 09:17:05
try stack ghc site && ./site rebuild, or stack exec -- ./site.hs rebuild
buglebudabey 2017-01-26 09:17:10
sm so how can my changes in site.hs, such as adding a page, be made?
buglebudabey 2017-01-26 09:17:19
oh ok i'll try those
romano_ 2017-01-26 09:17:32
hi guys
fragamus 2017-01-26 09:17:51
is there a hoogle that i could use for stuff like this liftIO :: IO a -> Shell a
zipper 2017-01-26 09:18:32
geekosaur: I am trying to sneak random here http://lpaste.net/3956142630303170560#line11 based on the value of a
zipper 2017-01-26 09:18:52
but it just won't let me do any IO returning operation
zipper 2017-01-26 09:19:57
wait
fragamus 2017-01-26 09:20:23
like is turtle part of any of these hoogles and if so link please
geekosaur 2017-01-26 09:22:02
zipper, I have to think needing a random value there is odd
zipper 2017-01-26 09:22:29
geekosaur: I have an array and I want to pick one of it's elements at random
EvanR 2017-01-26 09:22:30
fragamus: i think locally installed hoogle searches everything you have installed
fragamus 2017-01-26 09:22:53
i guess thats the way to go
zipper 2017-01-26 09:23:16
geekosaur: Like in a list [1,2,3,4,5,6] how to get a random index to extract from
zipper 2017-01-26 09:23:27
*extract using
geekosaur 2017-01-26 09:23:34
fragamus, one oddity about hoogle is its default search is limited and you need a package constraint to search other things. hoogle.haskell.org does support 'package:turtle'
geekosaur 2017-01-26 09:23:53
although being the alpha hoogle it apparently doesn't do type searches right :*
fragamus 2017-01-26 09:23:59
yay!
EvanR 2017-01-26 09:24:20
alpha hoogle
EvanR 2017-01-26 09:24:27
fun to say
shapr 2017-01-26 09:24:41
geekosaur: does that work for command line hoogle as well?
shapr 2017-01-26 09:24:45
I could certainly benefit from that.
geekosaur 2017-01-26 09:24:48
yes iirc
AWizzArd 2017-01-26 09:24:54
The Learn You A Haskell book brings this code example: data Frank a b = Frank {frankField :: b a} It has a kind of Frank :: * -> (* -> *) -> * Is there a way to write this type down without the braces {}?
geekosaur 2017-01-26 09:25:26
data Frank a b = Frank (b a)
buglebudabey 2017-01-26 09:25:54
thank you sm, that worked, does it say to do that somewhere on the hakyll site and i missed it?
AWizzArd 2017-01-26 09:26:03
geekosaur: thanks
sm 2017-01-26 09:27:17
buglebudabey: no, it looks like the hakyll site could make this clearer
buglebudabey 2017-01-26 09:27:52
alright, that's too bad
sm 2017-01-26 09:28:06
send a bug report
sm 2017-01-26 09:28:47
while you're tweaking site.hs, it's often best to run it uncompiled (the second command I gave)
sm 2017-01-26 09:30:35
and if you make it a stack script (or if you have hakyll and any other deps installed user-wide) you don't need to type the "stack exec --" bit
buglebudabey 2017-01-26 09:31:01
sm - i couldn't run that second command, it said i didn't have permissions because i wasn't owner of ./stack and when i added a flag to allow-other-users it denied me
buglebudabey 2017-01-26 09:31:09
sm i ran the first two you gave
sm 2017-01-26 09:31:40
chmod +x site.hs might help
buglebudabey 2017-01-26 09:33:32
when you gave the command 'stack exec -- ./site.hs rebuild' did you mean ./site? sm
buglebudabey 2017-01-26 09:34:23
i changed it to ./site, now it works with the added permissions, thanks
sm 2017-01-26 09:34:50
buglebudabey: no, the idea was to run site.hs in interpreted mode, so your changes are always seen immediately
zipper 2017-01-26 09:35:06
Why do we convert haskell arrays to lists?
zipper 2017-01-26 09:35:20
It's something I've noticed
buglebudabey 2017-01-26 09:35:23
sm oh, well it gave me an error saying that {-- wasn't a command
buglebudabey 2017-01-26 09:35:43
{-# i mean
dram_phone 2017-01-26 09:35:47
https://docs.haskellstack.org/en/stable/GUIDE/#ghcrunghc
dram_phone 2017-01-26 09:36:30
And I suppose just exec-ing it didn't really work because https://docs.haskellstack.org/en/stable/GUIDE/#script-interpreter
kadoban 2017-01-26 09:36:51
You should just set it up according to the script interpreter link there if that's what you want to do.
dram_phone 2017-01-26 09:36:57
Ooh which leads to this:
dram_phone 2017-01-26 09:37:00
You can use stack to execute a Haskell source file
kadoban 2017-01-26 09:37:01
Then you can just run it, don't need to mess around with 'stack exec --'
dram_phone 2017-01-26 09:37:03
TIL
kadoban 2017-01-26 09:37:17
You don't even need the stack part, you can run it like any script, ./site.hs
dram_phone 2017-01-26 09:37:58
buglebudabey: Try this: 'stack site.hs'
buglebudabey 2017-01-26 09:38:28
dram_phone it works but theres some warning that said it expects stack options etc
sm 2017-01-26 09:39:04
right. site.hs can just have a #!/usr/bin/env runghc shebang line, but a stack shebang line means it can ensure dependencies are present
dram_phone 2017-01-26 09:39:13
ok so you still need to set it up according to that link
dram_phone 2017-01-26 09:39:20
the script interpreter link
buglebudabey 2017-01-26 09:39:52
ok so that link should set me right for everything?
kadoban 2017-01-26 09:40:40
Use the script interpreter one and follow it correctly, and sure. I use it all the time.
dram_phone 2017-01-26 09:40:41
It should set it up so ./site.hs works like it should
Ptival 2017-01-26 09:41:03
dram_phone: I'm actually stuck writing the Applicative instance, Todo t k <*> Done r = ...
Miroboru_ 2017-01-26 09:41:31
I have a lazy function, primes, and then do "plist = take 100000 primes". If I then use plist as an argument to a function, will it be evaluated every time it is used, or will it be evaluated once (that is - computing 100000 primes) and then used every time?
buglebudabey 2017-01-26 09:41:41
alright thanks
Ptival 2017-01-26 09:42:26
the only thing I can return is Todo t (\tr -> _), but then I only have (tr :: tr), (k :: tr -> Work (a -> b)), and (r :: a)
Miroboru_ 2017-01-26 09:42:50
I ask because I am trying to do this, and things are insanely slow....
Ptival 2017-01-26 09:43:11
so I can make (k tr :: Work (a -> b)), and case on it, and in the Done case I'm fine
Miroboru_ 2017-01-26 09:43:52
Is it possible to force the evaluation so that plist becomes an array (or list) of integers?