systadmin 2017-02-02 14:51:25
Haskell doesn't have loops built in?
Sonolin 2017-02-02 14:52:08
you mean recursion? Yes
systadmin 2017-02-02 14:53:11
Like `while` and `for` loops?
markasoftware 2017-02-02 14:53:59
systadmin: there's some weird monad replicateM and forM things
markasoftware 2017-02-02 14:54:03
but they're usually used sparingly
markasoftware 2017-02-02 14:54:05
usually just recursion
Sonolin 2017-02-02 14:54:06
no, haskell is a functional language and isn't going to have a similar thing
markasoftware 2017-02-02 14:54:20
they're for special purposes (mainly I/O related i think)
halogenandtoast 2017-02-02 14:54:40
The recursion in Haskell though it so beautiful, that it took me a long time to realize it didn't have oop style loops.
halogenandtoast 2017-02-02 14:54:48
s/it so/is so/
markasoftware 2017-02-02 14:55:42
it's still a bit confusing sometimes to me, to get my head around how to do a more complex problem without a loop
yushyin 2017-02-02 14:56:56
we have a monadic while \o/ https://hackage.haskell.org/package/loop-while-1.0.0/docs/Control-Monad-LoopWhile.html
ertes 2017-02-02 14:59:57
systadmin: loops don't make sense in haskell
ertes 2017-02-02 15:00:25
systadmin: programs are first-class values, and the way you would write imperative loops is by constructing programs that do stuff repeatedly
ertes 2017-02-02 15:00:36
easy example: 'forever'
ertes 2017-02-02 15:01:14
forever action = action >> forever action -- (forever action) is the action that first runs 'action' and then (forever action)
ertes 2017-02-02 15:01:57
in other words: loop constructs are really just regular haskell functions
markasoftware 2017-02-02 15:05:15
not sure if they're listening anymore...
stew 2017-02-02 15:13:02
I need help understanding some syntax I'm not familiar with. I'm trying to duplicate this example: https://hackage.haskell.org/package/console-program-0.4.2.0/src/Examples/Full.hs ; the "countUp" function here, appears to call a "command" funciton, which is the first function here: https://hackage.haskell.org/package/console-program-0.4.2.0/src/src/System/Console/Command.hs ; but I don't understand what is b
stew 2017-02-02 15:13:08
eing passed to this function: { name = "down",,, }
geekosaur 2017-02-02 15:15:19
that's record update syntax
erisco 2017-02-02 15:15:24
am I speaking any sort of sense here? http://lpaste.net/352019
Welkin 2017-02-02 15:15:48
erisco: you are always trying to do something weird
geekosaur 2017-02-02 15:15:50
`command` is a record, or something which produces a record; foo {...} is the record produced by foo with various fields replaced as specified in the {...}
Welkin 2017-02-02 15:16:01
you mean Command
Welkin 2017-02-02 15:16:01
:P
Welkin 2017-02-02 15:16:17
`command` is a kind of "smart constructor"
stew 2017-02-02 15:16:42
geekosaur: I don't understand. the type signature of command is "command :: String -> String -> Action m -> Command m"
Welkin 2017-02-02 15:17:12
yes, it takes a name, description and action
stew 2017-02-02 15:17:15
geekosaur: and the function application is command { name = "foo", description = "bar", ...}
Welkin 2017-02-02 15:17:16
and constructs a new Command
Welkin 2017-02-02 15:17:30
Command is a type constructor
stew 2017-02-02 15:17:40
geekosaur: are these things like name pulled out of this record positionally?
stew 2017-02-02 15:17:50
and why doesn't my compiler like it when I try to do the same thing?
Welkin 2017-02-02 15:17:52
the { name = n, ...} is record update syntax, which changes the values of the record
erisco 2017-02-02 15:17:54
I am not completely sure what to do with the disproofs
erisco 2017-02-02 15:18:10
we can do disproofs constructively but I don't see how with this setup
stew 2017-02-02 15:18:22
Welkin: changes to *which* record?
Welkin 2017-02-02 15:18:27
stew: Command
stew 2017-02-02 15:18:36
where does Command come from?
stew 2017-02-02 15:18:44
this is applying to a function command, not Command
erisco 2017-02-02 15:18:55
:<: can't contain both proofs and disproofs
stew 2017-02-02 15:19:11
is "command { name = "foo" }" doing something other than applying a single argument to a function?
Welkin 2017-02-02 15:19:14
https://hackage.haskell.org/package/console-program-0.4.2.0/src/src/System/Console/Internal.hs
Welkin 2017-02-02 15:19:22
you are typing that wrong stew
stew 2017-02-02 15:19:27
Welkin: how so?
Welkin 2017-02-02 15:19:28
it is not `command`
Welkin 2017-02-02 15:19:32
it is `Command`
Welkin 2017-02-02 15:19:36
they are not the same thing
stew 2017-02-02 15:19:36
no, its command
Welkin 2017-02-02 15:19:58
Command is defined in the file I linked
stew 2017-02-02 15:19:59
Welkin: see the definition of "countUp" here: https://hackage.haskell.org/package/console-program-0.4.2.0/src/Examples/Full.hs
Welkin 2017-02-02 15:20:04
command is just a function
stew 2017-02-02 15:20:08
exactly
Welkin 2017-02-02 15:20:57
what is your question?
stew 2017-02-02 15:21:09
how this works?
stew 2017-02-02 15:21:14
the example?
stew 2017-02-02 15:21:24
command { name = "foo", description = "bar" }
geekosaur 2017-02-02 15:21:31
Welkin, did you by any chance look at the referenced file? (definition of countUp)
Welkin 2017-02-02 15:21:33
maybe it doesn't
geekosaur 2017-02-02 15:21:35
which very definitely has a lowercase c
Welkin 2017-02-02 15:21:35
who knows
Welkin 2017-02-02 15:21:37
have you run it?
stew 2017-02-02 15:22:00
I tried to duplicate this in my project and can't get it to compile
Welkin 2017-02-02 15:22:07
I told you why
erisco 2017-02-02 15:22:12
I know there is %:< but I am just trying to see if I am grasping the concepts
geekosaur 2017-02-02 15:22:16
what I suspect is the example is out of date
Welkin 2017-02-02 15:22:17
don't blindly copy examples that may in fact be broken
stew 2017-02-02 15:22:18
Welkin: so the example is wrong?
erisco 2017-02-02 15:22:20
hard to see because they have it all hidden in TH
erisco 2017-02-02 15:22:36
I think I am on the money though
stew 2017-02-02 15:22:52
Welkin: what do you mean by blindly?
Welkin 2017-02-02 15:23:04
stew: the example may very well be wrong
stew 2017-02-02 15:23:09
right
geekosaur 2017-02-02 15:23:13
Welkin seems to think you are doing something other than asking why an example doesn't make sense
Welkin 2017-02-02 15:23:16
in this case, it must be
stew 2017-02-02 15:23:25
ok so shoudl I report this?
Welkin 2017-02-02 15:23:31
well, you didn't ask why the example makes no sense
Welkin 2017-02-02 15:23:42
you asked why your code (which you said you copied from that file) doesn't work
stew 2017-02-02 15:23:58
I don't understand the differencd I'm sorry I don't udnerstand what I'm doing wrong
stew 2017-02-02 15:24:00
just trying to learn
Welkin 2017-02-02 15:24:13
forget about the example
stew 2017-02-02 15:24:16
why?
Welkin 2017-02-02 15:24:27
because it's wrong/out of date/etc or something
stew 2017-02-02 15:24:30
if the example is wrong it should be fixed right?
Welkin 2017-02-02 15:24:38
sure, but that is not your goal, is it?
Welkin 2017-02-02 15:24:50
if so, you can make a pull request to the relevant repo
stew 2017-02-02 15:25:04
is that something I do through hub.darcs.net?
Welkin 2017-02-02 15:25:40
no idea
Welkin 2017-02-02 15:25:43
I don't use darcs
stew 2017-02-02 15:25:55
oh, how would you make a pull request then?
Welkin 2017-02-02 15:25:56
and this library is not just some random one to me
Welkin 2017-02-02 15:26:08
it's not part of base, so I don't think it's relevant to report bugs about it here
erisco 2017-02-02 15:26:09
problem with this is there are probably just a handful of people who understand it
Welkin 2017-02-02 15:26:19
is just some random one*
stew 2017-02-02 15:26:49
Welkin: where do I report bugs about it, I'm happy to do it wherever, this was the first place I thought to ask, sorry
Welkin 2017-02-02 15:26:55
if your goal is to have a working program, re-read my expalanation of Command vs command above
stew 2017-02-02 15:27:03
yeah, I get that
stew 2017-02-02 15:27:08
my goal now is to get the example fixed
Welkin 2017-02-02 15:27:10
stew: I don't know, since it's not my project
stew 2017-02-02 15:27:48
hmm
Benzi-Junior 2017-02-02 15:28:13
ok where does stack actually dump core when you add --ddump-simpl to the .cabal file ?
Welkin 2017-02-02 15:28:27
I don't see anywhere on the darcs page to report bugs or anything
Welkin 2017-02-02 15:28:33
maybe you need to be registered and signed in?
stew 2017-02-02 15:28:39
I just did, still don't see that
Welkin 2017-02-02 15:28:48
typically I do this through github
Welkin 2017-02-02 15:29:03
there is no contact information listed either
Welkin 2017-02-02 15:29:18
it looks like you are out of luck on that for now
geekosaur 2017-02-02 15:29:19
Benzi-Junior, somewhere under ~/.stack-work
stew 2017-02-02 15:29:21
i swear I've run into fundamental problems like this with the majority of the packages I try to use
geekosaur 2017-02-02 15:29:31
because stack itself is using some -d options with -ddump-to-file
Welkin 2017-02-02 15:29:33
sometimes packages just get abandoned too
stew 2017-02-02 15:29:48
so lets say this package was in fact abondoned. How would a fix get uploaded?
Welkin 2017-02-02 15:30:05
stew: it wouldn't
Welkin 2017-02-02 15:30:10
you would fork it and start a new one
stew 2017-02-02 15:30:20
it will never ever get fixed?
erisco 2017-02-02 15:30:23
damn now I have to think of how I determine if two things are the same type but not necessarily equal terms
Welkin 2017-02-02 15:30:24
or rewrite it yourself and start a new package
stew 2017-02-02 15:30:24
a new one with a new name?
stew 2017-02-02 15:30:45
that seems extreme
Welkin 2017-02-02 15:30:46
stew: yes
Welkin 2017-02-02 15:30:52
it has happened many times before with parsing libraries
Welkin 2017-02-02 15:31:20
usually for popular packages, it's not an issue
stew 2017-02-02 15:31:50
and how does one know if a package is popular? :)
erisco 2017-02-02 15:31:51
nvrmind
Welkin 2017-02-02 15:32:09
oh, I found an email in the .cabal
Welkin 2017-02-02 15:32:10
http://hub.darcs.net/AriePeterson/console-program/browse/console-program.cabal
Welkin 2017-02-02 15:32:16
ariep@xs4all.nl
stew 2017-02-02 15:33:03
so far I'm 0/4 on getting any kind of response from emailing package maintainers like this
Benzi-Junior 2017-02-02 15:34:59
geekosaur: any idea how to find out where
Welkin 2017-02-02 15:35:28
Benzi-Junior: any relation to benzrf?
Welkin 2017-02-02 15:35:45
stew: number of downloads
Welkin 2017-02-02 15:35:52
or it is part of base
Benzi-Junior 2017-02-02 15:36:10
Welkin: not that I'm aware of
Welkin 2017-02-02 15:36:46
Benzi-Junior: are you in israel?
Benzi-Junior 2017-02-02 15:36:54
no I am not
geekosaur 2017-02-02 15:37:52
Benzi-Junior, I'd use find to figure it out (you are looking for a file .dump-simpl)
stew 2017-02-02 15:38:35
well, I emailed the maintainer, I look forward to his reply....
erisco 2017-02-02 15:40:09
I think what I'd like to see is data Ordering (a :: k) (b :: k) where LT :: a :<: b -> Ordering a b; GT :: a :>: b -> Ordering a b; EQ :: a :~: a -> Ordering a a
Axman6 2017-02-02 15:40:41
an ordering on types?
Axman6 2017-02-02 15:40:49
or does that define an ordering on types?
erisco 2017-02-02 15:41:01
so it collects the various comparison proofs together... not sure if this works in practice with promotion and so on
erisco 2017-02-02 15:41:53
it doesn't define an ordering on types, it merely creates a sum kind of types, where the types are serving as propositions
erisco 2017-02-02 15:42:13
so it is the sum of the proposition a < b, a > b, and a = b
erisco 2017-02-02 15:43:15
I'd have to think if a GADT is what is appropriate here but that is roughly what I am thinking
erisco 2017-02-02 15:43:44
because as it stands it seems the best I can use is sCompare which gives me Sing Ordering and that contains no proofs
erisco 2017-02-02 15:43:59
so I can pattern match on it but discover nothing about the types
erisco 2017-02-02 15:44:12
then there is %~ where I can pattern match to discover equality
erisco 2017-02-02 15:44:37
so my code has to mix sCompare with %~
erisco 2017-02-02 15:44:55
sCompare to find EQ and then an essentially redundant %~ to get the equality proof out