Search Haskell Channel Logs

Sunday, January 29, 2017

#haskell channel featuring kadoban, liste, davean, lpaste, Axman6, lambdabot,

qmm 2017-01-29 19:13:03
how can i write: 2 + 2 \ -- some documentation
qmm 2017-01-29 19:13:18
+ 3 + 3 \ -- some more documentation
qmm 2017-01-29 19:13:28
* 2 -- further documenation
Axman6 2017-01-29 19:13:31
things which alls documentation -- ^ Some docs
Axman6 2017-01-29 19:13:45
allows*
Axman6 2017-01-29 19:13:55
I don't think you can quite write it like that though
Axman6 2017-01-29 19:14:13
(assuming you want this in haddock)
pavonia 2017-01-29 19:15:38
And you can't have any documentation for expressions, can you?
lpaste 2017-01-29 19:15:45
qmm pasted "example.hs" at http://lpaste.net/351786
pavonia 2017-01-29 19:16:50
qmm: What's wrong with this?
Axman6 2017-01-29 19:17:54
qmm: what result do you want from what? afaict that works
Axman6 2017-01-29 19:18:13
you might need to align the * with the 2 though
Axman6 2017-01-29 19:18:27
hmm, probably not
qmm 2017-01-29 19:20:29
Axman6: forgot to paste the error, here it is http://lpaste.net/9161310433737441280
qmm 2017-01-29 19:20:37
pavonia even
pavonia 2017-01-29 19:21:15
Ah right, putStrLn is expecting a String but you're giving it a number
pavonia 2017-01-29 19:21:25
> show (2 + 2)
lambdabot 2017-01-29 19:21:28
"4"
Axman6 2017-01-29 19:21:31
oh good catch
Axman6 2017-01-29 19:21:40
you want print qmm
Axman6 2017-01-29 19:21:44
:t putStrLn
lambdabot 2017-01-29 19:21:47
String -> IO ()
Axman6 2017-01-29 19:21:49
:t print
lambdabot 2017-01-29 19:21:51
Show a => a -> IO ()
qmm 2017-01-29 19:22:59
oh, right!
Axman6 2017-01-29 19:25:47
make sure you check the location of errors in error messages ;)
qmm 2017-01-29 19:35:29
is there an equivalent of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow for haskell? i need to move a decimal place two places to the right, but i'm told (without really understanding) that multiplying something by 100 isn't a generic enough solution
qmm 2017-01-29 19:36:23
Math.pow(10,2) is how i could do it with that function from js
wei2912 2017-01-29 19:36:36
qmm: i don't see what's the point of using Math.pow(10, 2) when it's 100
kadoban 2017-01-29 19:36:37
qmm: Is this for output, or?
qmm 2017-01-29 19:36:43
3.43343 * Math.pow(10,2) rather
kadoban 2017-01-29 19:36:47
And what type are you using? Double or something?
wei2912 2017-01-29 19:36:48
qmm: wait a moment, isn't this #haskell
wei2912 2017-01-29 19:36:54
oh, i see what you mean
liste 2017-01-29 19:37:01
> 5^3
lambdabot 2017-01-29 19:37:03
125
davean 2017-01-29 19:37:16
qmm: oh, do you want to move it in a SPECIFIC base? whatever base that happens to be?
liste 2017-01-29 19:37:17
> 5**3
lambdabot 2017-01-29 19:37:19
125.0
qmm 2017-01-29 19:37:31
kadoban: i don't actually know, a fractional of some sort
liste 2017-01-29 19:37:42
qmm: those 2 operators, ^ and **
liste 2017-01-29 19:37:52
:t ((^), (**))
wei2912 2017-01-29 19:37:53
probably stick with ^
lambdabot 2017-01-29 19:37:54
(Num a, Integral b, Floating a1) => (a -> b -> a, a1 -> a1 -> a1)
wei2912 2017-01-29 19:38:09
if you're using Fractional
qmm 2017-01-29 19:38:44
liste, wei2912: thought & and ** were for exponentiation. i didn't realize you could change bases
kadoban 2017-01-29 19:38:58
"pow" is exponentiation
qmm 2017-01-29 19:39:25
ah
liste 2017-01-29 19:40:10
"pow" is short for "power" or "to the power"
qmm 2017-01-29 19:40:58
> 2.3433 * (10 ^ (2))
lambdabot 2017-01-29 19:41:01
234.33
qmm 2017-01-29 19:41:13
thanks!
qmm 2017-01-29 19:42:00
the extra parens were left over from me playing with negative numbers