Search Haskell Channel Logs

Friday, March 3, 2017

#haskell channel featuring lambdabot, liste, SepakoRayl, ski, jle`, marekw2143, and 7 others.

jle` 2017-03-03 00:45:53
> x ^ 3
lambdabot 2017-03-03 00:45:57
x * x * x
jle` 2017-03-03 00:46:29
> x ^ 5
lambdabot 2017-03-03 00:46:29
x * x * (x * x) * x
brynser_ 2017-03-03 00:46:30
huh
ski 2017-03-03 00:47:00
it's probably using the repeated squaring method for computing powers
jle` 2017-03-03 00:47:09
@src (^)
lambdabot 2017-03-03 00:47:09
x ^ 0 = 1
lambdabot 2017-03-03 00:47:09
x ^ n | n > 0 = f x (n-1) x
lambdabot 2017-03-03 00:47:09
where
lambdabot 2017-03-03 00:47:09
f _ 0 y = y
lambdabot 2017-03-03 00:47:09
f x n y = g x n
lambdabot 2017-03-03 00:47:11
[3 @more lines]
ski 2017-03-03 00:47:52
@more
lambdabot 2017-03-03 00:47:53
where g x n | even n = g (x*x) (n `quot` 2)
lambdabot 2017-03-03 00:47:53
| otherwise = f x (n-1) (x*y)
lambdabot 2017-03-03 00:47:53
_ ^ _ = error "Prelude.^: negative exponent"
ij 2017-03-03 00:49:09
Could you define a monad without type classes? Somehow capture the idea as much as possible.
MarcelineVQ 2017-03-03 00:49:09
novakboskov: stack build accepts a --ghc-options flag for passing specific things, e.g. stack build --ghc-options="-O1 -prof" but it doesn't seem to accept -prof due to https://github.com/commercialhaskell/stack/issues/1015 :(
ski 2017-03-03 00:49:25
`f x n y = x ^ n * y' is the invariant there
MarcelineVQ 2017-03-03 00:49:40
novakboskov: appearantly it's inherited from https://github.com/haskell/cabal/issues/2827#issuecomment-141783201 since stack uses Cabal
brynser_ 2017-03-03 00:50:11
:t concatMap
lambdabot 2017-03-03 00:50:13
Foldable t => (a -> [b]) -> t a -> [b]
ski 2017-03-03 00:50:24
ij : yes, you could make a data type for the operations
liste 2017-03-03 00:50:59
ij: you could pass around the dictionaries yourself
liste 2017-03-03 00:51:27
so instead of Monad m => m Integer, you'd have Monad m -> m Integer
liste 2017-03-03 00:51:40
and Monad would be just a record of functions
ski 2017-03-03 00:52:09
ij : of course this requires higher-order types, to be able to abstract over arbitrary monads like this
novakboskov 2017-03-03 00:52:15
MarcelineVQ: I'm still investigate but something like `stack build --profile --ghc-options="-fno-prof-cafs"` acts like `ghc -prof -fprof-auto Module.hs`
MarcelineVQ 2017-03-03 00:54:23
are you sure that's not -fprof-auto-exported or -fprof-auto-top and not -fprof-auto?
MarcelineVQ 2017-03-03 00:54:59
I wonder if you can pass Cabal options somewhere, 1.23 provides http://cabal.readthedocs.io/en/latest/nix-local-build.html?highlight=--enable-profiling#cfg-flag---profiling-detail
novakboskov 2017-03-03 00:57:57
I guess... I really have no experience in this so I have to try... :)
ski 2017-03-03 00:59:24
weaver ?
JuanDaugherty 2017-03-03 00:59:54
code weaver
JuanDaugherty 2017-03-03 01:00:14
LP weaves code and doc
ski 2017-03-03 01:00:15
does that mean the same as staged programming ?
JuanDaugherty 2017-03-03 01:00:30
no like in AOP
ski 2017-03-03 01:00:40
oh, Literate Programming. i was for some reason thinking Logic Programming
JuanDaugherty 2017-03-03 01:01:52
prolly cause you know me mostly from prolog
ski 2017-03-03 01:02:01
possibly
MarcelineVQ 2017-03-03 01:04:59
novakboskov: I can't seem to find anything particularily helpful beyond the mentioned links
MarcelineVQ 2017-03-03 01:05:28
especially I don't see any way to pass cabal options, possibly it's because such things are really cabal-install options which stack isn't.
MarcelineVQ 2017-03-03 01:05:54
though idk if that's the case, just my immediate thought
mathkb 2017-03-03 01:06:32
I am looking for the wiki page that speak about hiding the type constructor. How is this idiom called?
MarcelineVQ 2017-03-03 01:07:23
novakboskov: poossssibly if you specify your .cabal version to be >= 1.23 you could set these as options in your .cabal file, lemme see
marekw2143 2017-03-03 01:09:10
hello
ski 2017-03-03 01:09:37
hello
marekw2143 2017-03-03 01:11:05
is there something wrong near here https://bitbucket.org/chessRepo/c7/src/08f9d9bd00825500ba10056bedbdbd410b1f9975/main.hs?at=master&fileviewer=file-view-default#main.hs-131 ?
marekw2143 2017-03-03 01:12:11
compiler tells me : main.hs:131:20: parse error on input '='
novakboskov 2017-03-03 01:12:56
Marceline
ski 2017-03-03 01:13:54
marekw2143 : `getNextMoves' has no body after `do'
marekw2143 2017-03-03 01:14:12
oh
ski 2017-03-03 01:14:19
you could put `undefined' there for the time being
MarcelineVQ 2017-03-03 01:14:28
novakboskov: stack doesn't seem to recognise cabal .project files so it may not be possible to specify these flags manually :(
marekw2143 2017-03-03 01:15:32
ski: ok, works
marekw2143 2017-03-03 01:15:42
undeifned is just a mock?
marekw2143 2017-03-03 01:15:45
or a type in haskell
ski 2017-03-03 01:15:45
yes
ski 2017-03-03 01:15:50
@src undefined
lambdabot 2017-03-03 01:15:50
undefined = error "Prelude.undefined"
ski 2017-03-03 01:16:03
it's not a type, it's an ordinary variable
MarcelineVQ 2017-03-03 01:16:07
novakboskov: this is a .project file, it's different than a .cabal file and appearantly where these options could be passed if not on the command line, but stack doesn't seem to check it: http://cabal.readthedocs.io/en/latest/nix-local-build.html#configuring-builds-with-cabal-project
marekw2143 2017-03-03 01:16:22
ski, but it can be assigned to everything ?
ski 2017-03-03 01:16:33
it has every type, yes
ski 2017-03-03 01:16:36
@type undefined
lambdabot 2017-03-03 01:16:40
a
marekw2143 2017-03-03 01:17:20
ski, :)
marekw2143 2017-03-03 01:17:46
btw, are there lot of people using haskell in their daily job ?
novakboskov 2017-03-03 01:18:19
MarcelineVQ: Nevermind, --ghc-options stack flag is OK for my current needs... It seems like this is the only way to pass these options all the way down to ghc. Thank you! :)
MarcelineVQ 2017-03-03 01:20:15
np, note that you should be able to turn off things with ghc options, so you could stack build --profile --ghc-options="-fno-prof-cafs" or somesuch, dunno if that works as expected
MarcelineVQ 2017-03-03 01:21:16
ah you mentioned that earlier anyway hehe :>
halogenandtoast 2017-03-03 01:21:50
Is there a preferred safe library for HTTP requests?
SepakoRayl 2017-03-03 01:22:03
hello everyone
brynser_ 2017-03-03 01:22:12
hi
JuanDaugherty 2017-03-03 01:23:27
halogenandtoast, last i knew there was only streit for the title
brynser_ 2017-03-03 01:24:58
halogenandtoast: check http://haskelliseasy.readthedocs.io/en/latest/#http-clients
brynser_ 2017-03-03 01:26:36
http-conduit also has a Simple module which is my current go-to, tutorial here: https://haskell-lang.org/library/http-client
halogenandtoast 2017-03-03 01:27:29
brynser_: I'll check it out.
halogenandtoast 2017-03-03 01:29:20
thanks
brynser_ 2017-03-03 01:36:01
np :)