Search Haskell Channel Logs

Sunday, January 29, 2017

#haskell channel featuring t0by, Axman6, cocreature, MarcelineVQ, Lokathor, reactormonk, and 7 others.

systadmin 2017-01-28 22:45:43
orzo should I change anything in the lines of codes above it?
orzo 2017-01-28 22:46:07
i dont really know what you're asking me
systadmin 2017-01-28 22:46:34
Nevermind
systadmin 2017-01-28 22:46:42
How did repeatStr n s = [1..n] >> s work?
orzo 2017-01-28 22:47:02
it works because list is a Monad
systadmin 2017-01-28 22:47:20
A Monad...
orzo 2017-01-28 22:47:41
the (>>) operator for a list means to repeat every instance of the second list for each member of the first
systadmin 2017-01-28 22:47:43
I'm still far from the chapter with Monads in the book I'm reading
reactormonk 2017-01-28 22:47:48
uri-bytestring must match >=0.2 && <0.3, but the stack configuration has no specified version (latest applicable is 0.2.2.1) -- should work, what am I misunderstanding?
cocreature 2017-01-28 22:48:27
systadmin: it might make sense for you to try to solve the exercises yourself or read some introduction to haskell if you are not yet able to write it yourself.
orzo 2017-01-28 22:48:32
yeah, [1..n] >> s wasn't even what i came up with initially
Lokathor 2017-01-28 22:48:46
systadmin, unfortunately for the beginner, many parts of Haskell that make it easy to use once you know all the basics are also what make it hard to use before you know all the basics
orzo 2017-01-28 22:48:49
it's what i came up with after being bored with my first idea
cocreature 2017-01-28 22:49:32
systadmin: think about how you would solve this problem on an abstract level and then try to translate that into haskell
reactormonk 2017-01-28 22:49:32
ahh, oops. stack config, not cabal. Gotta read the error messages.
cocreature 2017-01-28 22:49:50
reactormonk: you need to add it to extra-deps
reactormonk 2017-01-28 22:50:00
cocreature, yeah, gotta read the error messages.
cocreature 2017-01-28 22:50:02
reactormonk: that message means that the package is on hackage but not in the stackage snapshot
orzo 2017-01-28 22:50:03
systadmin: i recommend you ignore the >> solution and find something that makes sense with what you know and have covered so far.
cocreature 2017-01-28 22:50:14
reactormonk: tbh the error message is pretty confusing
MarcelineVQ 2017-01-28 22:50:26
odd, what lts are you using? uri-bytestring has been on stackage for awhile
reactormonk 2017-01-28 22:50:39
cocreature, no. "Recommended action: try adding the following to your extra-deps in stack.yaml: uri-bytestring-0.2.2.1"
reactormonk 2017-01-28 22:50:52
MarcelineVQ, some old nightly
reactormonk 2017-01-28 22:50:57
nightly-2016-09-24
cocreature 2017-01-28 22:51:14
reactormonk: I still think it's confusing because "latest applicable" makes it seem like it should work
reactormonk 2017-01-28 22:53:48
Huh. lts-7.18 still uses aeson 0.x instead of 1.x
reactormonk 2017-01-28 22:55:44
How do you request an upgrade?
systadmin 2017-01-28 23:00:04
Is LYAH a good book?
cocreature 2017-01-28 23:00:23
systadmin: the opinions vary but I liked it
maredebianum 2017-01-28 23:02:15
How can I upgrade package pandoc to latest version? here is what I tried: http://lpaste.net/3280977104266592256
seequ_ 2017-01-28 23:02:49
Learn You A Haskell is great if you have no functional programming background
Lokathor 2017-01-28 23:03:11
seequ_, i would dispute that
t0by 2017-01-28 23:03:13
seequ_: I sorta disagree.
t0by 2017-01-28 23:03:22
I find that's precisely the case where you don't want LYAH
Lokathor 2017-01-28 23:03:29
LYAH lets you kinda read haskell, but you'll probably not be equipped to write haskell at all by the end
Lokathor 2017-01-28 23:04:14
systadmin, http://www.seas.upenn.edu/~cis194/spring13/lectures.html try here for some good companion practice to go along with LYAH
Axman6 2017-01-28 23:04:23
maredebianum: it's probably because you have versions of dependencies which conflict with the versions needed by 1.19 already installed
seequ_ 2017-01-28 23:04:32
Huh. I precisely found it useful because it taught me the basic concepts
systadmin 2017-01-28 23:04:47
I'm reading Haskell Programming but I was wondering if people liked LYAH
systadmin 2017-01-28 23:05:18
Lokathor: CIS194 is also written by the author of Haskell Programming
Lokathor 2017-01-28 23:05:54
systadmin, no, they just suggest CIS194. the book and the course are different people
Axman6 2017-01-28 23:05:56
is it?
Axman6 2017-01-28 23:06:02
thought so
systadmin 2017-01-28 23:06:04
Oh
Lokathor 2017-01-28 23:06:20
systadmin, Haskell Programming is an A++ book
systadmin 2017-01-28 23:06:20
Maybe I do CIS194 alongside HB
Lokathor 2017-01-28 23:07:01
Haskell Programming + Parallel and Concurrent Programming in Haskell will have you set to begin any number of Haskell projects
Lokathor 2017-01-28 23:07:29
(http://chimera.labs.oreilly.com/books/1230000000929/index.html for the latter book, but it's only suitable once you've finished Haskell Programming)
systadmin 2017-01-28 23:08:25
I've mostly been learning Haskell expressions by relating them to Python expressions
Lokathor 2017-01-28 23:08:58
I would try to consider Haskell expressions in their own right when possible, as you go along
systadmin 2017-01-28 23:09:00
This is the book I'm reading http://haskellbook.com/
Lokathor 2017-01-28 23:09:07
eventually it will all jel togtether
Lokathor 2017-01-28 23:09:24
yep, it's a top tier book
maredebianum 2017-01-28 23:09:36
Axman6: how can I resolve these, is there no upgrade concept? I remember this was difficult before, too. Do I need to wipe ~/.cabal and hope for a recompile? I updated the paste, it seems the base package is the problem here. Do I need to sove all dependencies by hand?
systadmin 2017-01-28 23:09:48
tbh, I torrented that book
Lokathor 2017-01-28 23:10:01
!
systadmin 2017-01-28 23:10:10
Because a lot of people recommend it above all the others
Lokathor 2017-01-28 23:10:17
go pay them, it's worth the price
systadmin 2017-01-28 23:10:35
Yeah,the version of the eBook I got is slightly out of date
systadmin 2017-01-28 23:10:49
I'm missing the last 2 chapters
samvher 2017-01-28 23:13:53
Hi, quick question: if I see a type declaration under class ... where, this is enabled by some language extension right? Which extension would that be?
samvher 2017-01-28 23:14:33
I'm looking at Web.Spock.Internal.Types - it has "class HasSpock m where\n type SpockConn m :: *", I don't entirely understand what's going on there
cocreature 2017-01-28 23:15:56
samvher: it's part of TypeFamilies
MarcelineVQ 2017-01-28 23:15:56
it's related to type families samvher: https://ocharles.org.uk/blog/posts/2014-12-12-type-families.html
cocreature 2017-01-28 23:16:18
it's called "associated type"
samvher 2017-01-28 23:16:22
thanks! I'll check that out
maredebianum 2017-01-28 23:19:15
How can I force a cabal install? It may break any packages but the one I need and its dependencies ;)
maredebianum 2017-01-28 23:19:43
cabal list
systadmin 2017-01-28 23:23:16
You're using cabal?
systadmin 2017-01-28 23:23:29
maerwald ^^^
systadmin 2017-01-28 23:23:35
maredebianum:
cocreature 2017-01-28 23:24:38
maredebianum: "base" is tied to GHC so the only way to upgrade base is to upgrade GHC
cocreature 2017-01-28 23:24:57
maredebianum: it looks like pandoc requires baes >= 4.7 which is equivalent to GHC >= 7.10
cocreature 2017-01-28 23:25:01
eh 7.8
systadmin 2017-01-28 23:25:13
I recommend Stack over Cabal
Lokathor 2017-01-28 23:26:04
as do i, but that still wouldn't solve the version issue with base :P
systadmin 2017-01-28 23:27:43
https://docs.haskellstack.org/en/stable/install_and_upgrade/#installupgrade
maredebianum 2017-01-28 23:27:49
systadmin: I typed this cabal command in wrong window ;) I just moved ~/.cabal away, my system package provides ghc 7.6.3 only, can I compile it with cabal? I see Default available version: [ Not available from any configured repository ]
maredebianum 2017-01-28 23:28:26
systadmin: ah, thanks, will try that now
systadmin 2017-01-28 23:28:38
Stack is just easier
systadmin 2017-01-28 23:28:44
Takes care of GHC updates
cocreature 2017-01-28 23:29:17
maredebianum: what system are you on that provides ghc 7.6? that's quite old so it might be worth upgrading or at least adding some repository that provides newer versions
systadmin 2017-01-28 23:29:36
The current version is 8.0.1 right?
cocreature 2017-01-28 23:29:44
8.0.2
systadmin 2017-01-28 23:29:48
wat
maredebianum 2017-01-28 23:30:03
systadmin: thanks, unfortunately system packages are quite old, Ubuntu 14.04 LTS here
Lokathor 2017-01-28 23:30:07
8.0.2 isn't in an LTS yet though
cocreature 2017-01-28 23:30:20
maredebianum: https://launchpad.net/~hvr/+archive/ubuntu/ghc
systadmin 2017-01-28 23:30:21
My version is 8.0.1
Lokathor 2017-01-28 23:30:40
maredebianum, you can just install stack without using the package manager and it can get GHC itself without using the package manager.
Lokathor 2017-01-28 23:30:55
unless you're picky about the package manager always being in charge of all things
maredebianum 2017-01-28 23:34:29
ppa is usually fine, if you find a maintained one (automated upgrades: yes please ;) I go with that first, then with newest ghc/base everything missing should compile.
systadmin 2017-01-28 23:40:28
What does Haskell have in place of Python's input()?
mrkgnao 2017-01-28 23:40:45
systadmin: readLine and read
mrkgnao 2017-01-28 23:40:52
> :t readLine
lambdabot 2017-01-28 23:40:54
:1:1: error: parse error on input ':'
mrkgnao 2017-01-28 23:40:59
:t readLine
lambdabot 2017-01-28 23:41:01
error:
lambdabot 2017-01-28 23:41:01
• Variable not in scope: readLine
lambdabot 2017-01-28 23:41:01
• Perhaps you meant one of these:
mrkgnao 2017-01-28 23:41:08
oh, sorry
mrkgnao 2017-01-28 23:41:13
:t getLine
systadmin 2017-01-28 23:41:14
:t (readLine)
lambdabot 2017-01-28 23:41:15
IO String
lambdabot 2017-01-28 23:41:16
error:
lambdabot 2017-01-28 23:41:16
• Variable not in scope: readLine
lambdabot 2017-01-28 23:41:16
• Perhaps you meant one of these:
mrkgnao 2017-01-28 23:41:25
getLine is what you want
systadmin 2017-01-28 23:41:29
So it's getLine?
mrkgnao 2017-01-28 23:41:54
yes. and you can use read to parse ints and such out of strings
systadmin 2017-01-28 23:41:56
let something = getLine
systadmin 2017-01-28 23:42:01
Something like that?
mrkgnao 2017-01-28 23:42:30
no, it's an IO action, so you want to use do-notation or similar things.
systadmin 2017-01-28 23:42:49
:t do
lambdabot 2017-01-28 23:42:50
error: Empty 'do' block
mrkgnao 2017-01-28 23:43:04
main = do s <- getLine; putStrLn ("You entered " ++ s)
systadmin 2017-01-28 23:44:07
What does `do` do?
mrkgnao 2017-01-28 23:44:59
it's a nice notation for monads, that's all. you can just use (>>=) (the "bind" operator) if you like.