EvanR 2017-02-28 07:45:50
> 'c' + True
lambdabot 2017-02-28 07:45:52
error:
lambdabot 2017-02-28 07:45:53
• Couldn't match expected type 'Char' with actual type 'Bool'
lambdabot 2017-02-28 07:45:53
• In the second argument of '(+)', namely 'True'
Cale 2017-02-28 07:45:53
kubunto: Or you can use the thing that mueval uses, called hint, which is itself a wrapper around the GHC API
kubunto 2017-02-28 07:46:12
Cale: where is hint
Cale 2017-02-28 07:46:16
Basically, you'll end up including GHC as a library in your program
Cale 2017-02-28 07:46:32
http://hackage.haskell.org/package/hint
kubunto 2017-02-28 07:47:34
wow, missing hs file
kubunto 2017-02-28 07:47:38
awesomesause
Cale 2017-02-28 07:47:38
?
kubunto 2017-02-28 07:47:54
the example.hs file is gone
Cale 2017-02-28 07:48:11
http://hackage.haskell.org/package/hint-0.6.0/src/examples/example.hs ?
Cale 2017-02-28 07:48:23
loads for me
drdo 2017-02-28 07:48:29
Does ScopedTypedVariables not work with constraints?
Cale 2017-02-28 07:48:54
drdo: It works with basically everything, as far as I'm aware.
kubunto 2017-02-28 07:48:56
Cale: the link on the original page you gave me doesnt
drdo 2017-02-28 07:49:03
Cale: sec, I'll post the example
lpaste_ 2017-02-28 07:49:52
drdo pasted "No title" at http://lpaste.net/353069
ertes 2017-02-28 07:49:52
kubunto: it's from the README, which is github-relative
ertes 2017-02-28 07:50:03
so it doesn't work from hackage
drdo 2017-02-28 07:50:32
Cale: For some reason GHC thinks those "p" are distinct
ertes 2017-02-28 07:50:34
or rather repo-relative
kubunto 2017-02-28 07:51:02
either way, i dont think i can nessesarily use those libraries
kubunto 2017-02-28 07:51:41
might have to have a bash script staple 2 together
Cale 2017-02-28 07:51:50
drdo: That's because you're not using the extension. You need to forall the variables you want to be scoped.
drdo 2017-02-28 07:52:15
Cale: Oh, you need to add the explicit forall for it to be scoped?
drdo 2017-02-28 07:52:18
Didn't know that
Cale 2017-02-28 07:52:35
yeah
drdo 2017-02-28 07:52:51
Cool, thanks
kubunto 2017-02-28 07:53:14
ill probably set one script to create an hs file and then compile and execute from a bash script
kubunto 2017-02-28 07:53:33
gotta love over engineering
ertes 2017-02-28 07:53:53
kubunto: there is also 'runhaskell'
EvanR 2017-02-28 07:53:55
sounds like a security issue
EvanR 2017-02-28 07:54:03
potentially
shapr 2017-02-28 07:54:16
Isn't that why SafeHaskell was created?
ertes 2017-02-28 07:54:31
kubunto: it's not clear whether you want to execute a haskell source file, or whether you want to integrate a haskell interpreter into your program
kubunto 2017-02-28 07:54:42
well it is on a server which only i really have access to
kubunto 2017-02-28 07:55:19
ertes: a bash script that runs a haskell executable which would generate a .hs to be compiled and executed
kubunto 2017-02-28 07:55:35
i know i am working too hard at this
ertes 2017-02-28 07:55:54
kubunto: why doesn't the outer program already do what the inner program is supposed to do?
EvanR 2017-02-28 07:55:58
thats what your solution is, but not your problem
ertes 2017-02-28 07:56:23
why the shell round-trip?
kubunto 2017-02-28 07:56:44
because i wanna execute an equation generated by the first one
EvanR 2017-02-28 07:56:57
execute an equation??
ertes 2017-02-28 07:57:05
kubunto: explain your problem, not the solution
kubunto 2017-02-28 07:57:37
i have a program that would generate an equation like add 3 4
kubunto 2017-02-28 07:57:42
as a string
ertes 2017-02-28 07:57:48
kubunto: ok, why?
EvanR 2017-02-28 07:57:48
thats an expression
kubunto 2017-02-28 07:57:52
but i wanna execute it as 3 + 4
EvanR 2017-02-28 07:58:04
you want to evaluate it
kubunto 2017-02-28 07:58:17
EvanR: cept it is a string
ertes 2017-02-28 07:58:23
kubunto: why doesn't the program just evaluate 3 + 4 right away instead of producing a haskell program that does?
shapr 2017-02-28 07:58:26
write an interpreter?
EvanR 2017-02-28 07:58:29
and are you sure you dont want to evaluate it as an algebraic data type, not a string
kubunto 2017-02-28 07:59:42
ertes: ill write something up for that when i get back
ertes 2017-02-28 07:59:53
kubunto: you're still explaining your solution, while the actual problem remains a mystery… if you want to stop overengineering this, explain the *problem*
EvanR 2017-02-28 08:00:15
the input is a string, you could write a parser to get an expression data structure, which could be evaluated directly
EvanR 2017-02-28 08:00:27
"add 3 4" ==> Add 3 4
kubunto 2017-02-28 08:00:48
EvanR: this is the resulting string out of a tree traversal
EvanR 2017-02-28 08:01:04
Add (N 3) (N 4) ==> N 7
ertes 2017-02-28 08:01:08
kubunto: why is the result a string?
ertes 2017-02-28 08:01:29
again: i'm almost willing to bet that anything that involves parsers or interpreters is the wrong solution here
kubunto 2017-02-28 08:02:01
ertes: i could evaluate each sub equation at traversal time
Cale 2017-02-28 08:02:16
kubunto: Maybe generate the string at the same time as performing the arithmetic alongside that?
kubunto 2017-02-28 08:02:24
^
kubunto 2017-02-28 08:02:29
thats what i am thinking
Cale 2017-02-28 08:02:36
Sounds reasonable to me
ertes 2017-02-28 08:02:44
and of course haskell is lazy, so you don't have to worry about passes too much
kubunto 2017-02-28 08:03:24
fp is fun times
ertes 2017-02-28 08:03:31
in any case, don't produce haskell source code =)
kubunto 2017-02-28 08:03:46
ill use pattern matching instead
EvanR 2017-02-28 08:04:01
good idea
Tuplanolla 2017-02-28 08:05:50
I like the way this problem went from a metacircular Haskell interpreter to pattern matching on a tree.
EvanR 2017-02-28 08:06:27
the solutions did at least
EvanR 2017-02-28 08:06:34
the problem is unknown
okrasit 2017-02-28 08:06:46
what is this crap? O
EvanR 2017-02-28 08:06:46
the problem is polymorphic
drdo 2017-02-28 08:08:34
Does there happen to be an extension for holes similar to agda?
drdo 2017-02-28 08:08:55
And something helpful in haskell-mode to go with it :)
ertes 2017-02-28 08:09:27
drdo: poor man's holes are available
ertes 2017-02-28 08:09:34
drdo: just start an identifier name with an underscore
ertes 2017-02-28 08:09:55
drdo: GHC will then give you the type of the whole as well as an overview of the types and values in scope
ertes 2017-02-28 08:10:28
drdo: if you enable -fdefer-typed-holes, you can even compile your program… the hole error turns into a hole warning, and the hole itself turns into a run-time bottom
drdo 2017-02-28 08:10:30
Guess I need to enable something?
EvanR 2017-02-28 08:10:41
nope
ertes 2017-02-28 08:10:42
drdo: no, holes work out of the box
ertes 2017-02-28 08:11:12
s/whole/hole/
drdo 2017-02-28 08:12:30
I must be doing something wrong
ertes 2017-02-28 08:13:07
drdo: which GHC version?
drdo 2017-02-28 08:13:17
It says it finds the hole, but then claims it infered type "t", where "t" appears to be a fresh variable
drdo 2017-02-28 08:13:21
ertes: 8.0.2
ertes 2017-02-28 08:13:49
drdo: it needs enough context to give you more specific types, of course
ertes 2017-02-28 08:14:01
main = let x = 3 in print (x + _)
EvanR 2017-02-28 08:14:06
it reports the most general type thta will work
drdo 2017-02-28 08:14:16
EvanR: Then it's definitely wrong
drdo 2017-02-28 08:15:47
foo = (let a = _a ; b = _b in a + b) ∷ Int
drdo 2017-02-28 08:16:00
GHC says: "Found hole: _a :: t"
drdo 2017-02-28 08:16:09
Same for _b
Tuplanolla 2017-02-28 08:16:33
Does it not tell you the constraints of `t` later, drdo?
drdo 2017-02-28 08:16:58
"Where: 't' is a rigid type variable bound by the inferred type of a :: t"
ertes 2017-02-28 08:17:02
drdo: seems like holes are pre-MMR then
drdo 2017-02-28 08:17:07
Which is equality unhelpful
drdo 2017-02-28 08:17:11
It should clearly infer Int
ertes 2017-02-28 08:17:12
drdo: because pre-MMR that *is* the actual type
ertes 2017-02-28 08:17:17
no, not clearly
ertes 2017-02-28 08:17:55
if you view 'a' in isolation, its type is completely undetermined
ertes 2017-02-28 08:18:26
in fact i'm sure agda would tell you the same thing
drdo 2017-02-28 08:18:40
I strongly doubt that
drdo 2017-02-28 08:18:44
Let's test
drdo 2017-02-28 08:22:20
ertes: It says the expected
drdo 2017-02-28 08:22:37
foo : ℕ
drdo 2017-02-28 08:22:37
foo = let a = {!!} ; b = {!!} in a + b
drdo 2017-02-28 08:22:44
?0 : ℕ
drdo 2017-02-28 08:22:44
?1 : ℕ
lambdabot 2017-02-28 08:22:45
Maybe you meant: v @ ? .
lambdabot 2017-02-28 08:22:45
: ℕ
drdo 2017-02-28 08:23:06
It's kinda obvious that it should
ertes 2017-02-28 08:23:14
i stand corrected then… in any case, typed holes in GHC are far less powerful
drdo 2017-02-28 08:23:16
Otherwise holes wouldn't be very useful
ertes 2017-02-28 08:23:40
in this particular case i'm pretty sure that GHC does not look at the context first, so it will sometimes infer more general types
drdo 2017-02-28 08:23:45
ertes: If this is what it does, I'd say it's useless
drdo 2017-02-28 08:24:01
Other than as a placeholder for code you want to write later
drdo 2017-02-28 08:24:13
ertes: But context is what holes are all about
ertes 2017-02-28 08:24:22
drdo: it has been useful to me in the past, especially to look at the types of things that are locally in scope
drdo 2017-02-28 08:24:30
You want to know the type you need as precisely as possiblre
drdo 2017-02-28 08:24:32
*possible
ertes 2017-02-28 08:24:36
but obviously typed holes are not nearly as powerful as agda holes =)
raspberryPI 2017-02-28 08:25:44
are the Stack Servers down?
drdo 2017-02-28 08:26:13
ertes: It also would be useful to know what type an expression would have if placed in that context
raspberryPI 2017-02-28 08:26:13
cause when I use curl or wget I get this error 0curl: (7) Failed to connect to github-cloud.s3.amazonaws.com port 443: Connection timed out
raspberryPI 2017-02-28 08:26:16
curl download failed: https://www.stackage.org/stack/linux-arm
shapr 2017-02-28 08:26:26
raspberryPI: yes, Amazon S3 US-East-1 is down
Darwin226 2017-02-28 08:26:35
I was just about to ask lol
Darwin226 2017-02-28 08:26:43
Anything that can be done?
dolio 2017-02-28 08:27:00
drdo, ertes: No. Let in agda is less powerful.
raspberryPI 2017-02-28 08:27:40
Darwin226: I think the download page still works :P
raspberryPI 2017-02-28 08:27:43
https://docs.haskellstack.org/en/stable/install_and_upgrade/#manual-download_3
raspberryPI 2017-02-28 08:28:03
or not
Darwin226 2017-02-28 08:28:07
I can't do a "stack build" thought
Darwin226 2017-02-28 08:28:14
after adding a new dep
dolio 2017-02-28 08:28:33
Also there's no overloading.
dolio 2017-02-28 08:29:19
Or, no constrained polymorphism.
ertes 2017-02-28 08:29:32
yeah, true
ertes 2017-02-28 08:30:04
'where' might be more difficult for agda
dolio 2017-02-28 08:30:24
Agda has where, and it's more powerful than let.
dolio 2017-02-28 08:32:08
Let is very limited, which is why you don't have to (and, I think, can't) annotate the values you're defining.
kubunto 2017-02-28 08:33:00
ertes: btw, the reason it was a string is because i cant data type well yet
dolio 2017-02-28 08:33:02
It doesn't do function definitions, or recursion, or polymorphism.
ertes 2017-02-28 08:36:11
kubunto: that's why you should always explain the problem first… we can guide you to good solutions and tell you where to find the proper learning materials
kubunto 2017-02-28 08:40:28
ertes: how would i be able to create a mixed type data structure?
ertes 2017-02-28 08:40:46
kubunto: do you have an example?
raspberryPI 2017-02-28 08:40:57
is there a get.haskellstack.org mirror?
ertes 2017-02-28 08:41:21
kubunto: like a heterogenous list?
kubunto 2017-02-28 08:41:38
ertes: this is my base structure data Equation a = Digit a | Operator a (Equation a) (Equation a)
kubunto 2017-02-28 08:41:55
ideally digit would be a num and operator would be a string
ertes 2017-02-28 08:42:22
kubunto: data Equation = Digit Rational | Operator String Equation Equation
raspberryPI 2017-02-28 08:42:45
is there a get.haskellstack.org mirror?
ertes 2017-02-28 08:42:51
or: data Equation d o = Digit d | Operator o (Equation d o) (Equation d o)