Search Haskell Channel Logs

Sunday, February 5, 2017

#haskell channel featuring Phyx-, Tuplanolla, boojinks, lyxia, sternmull, ertes, and 7 others.

reactormonk 2017-02-05 09:49:11
hpc, yeah, I know the rest, just wondering specifically about ghci.
eschnett 2017-02-05 09:51:38
I'm looking at free applicative functors, e.g. described in https://paolocapriotti.com/assets/applicative.pdf . I notice that Control.Applicative.Free uses a different representation — the type parameters are reversed. Why?
eschnett 2017-02-05 09:52:24
I would have expected `Ap :: f b -> Ap f (b -> a) -> Ap f a`, but the `a` and `b` are reversed…
Tuplanolla 2017-02-05 09:55:30
It's a Haskell convention to name the types such that functions go from `a` to `b`, eschnett.
eschnett 2017-02-05 09:56:15
Tuplanolla: Isn't `a` bound by the type declaration?
eschnett 2017-02-05 09:56:29
`data Ap f a where` …
Tuplanolla 2017-02-05 09:56:59
Oh, I see what you mean now.
sm 2017-02-05 09:58:53
Phyx-: re "C sources shouldn't be much of an issue anymore" - why's that ? more details welcome
fendor 2017-02-05 09:59:11
hello! i started programming in haskell a while ago and started to implement a connect four game and i was wondering myself, is there any convention for an application architecture?
fendor 2017-02-05 09:59:37
i just started coding and introduced functions, after a while, i used the elm architecture to define updates and models
fendor 2017-02-05 10:00:17
i could not find any resources on how to develop a program in haskell, and how the architecure may look like
sm 2017-02-05 10:00:20
fendor: for a game, your gui framework/game engine will often determine it
Tuplanolla 2017-02-05 10:01:34
You should probably ask edwardk since he wrote that thing, eschnett.
fendor 2017-02-05 10:01:54
well, in the current state, the gui is not final, it may be something drawn by gloss, but it might as well be a server application that you can play with over a webinterface
Phyx- 2017-02-05 10:03:30
sm: well, mostly because the runtime linker has had significant changes since 7.x days. 7.10.3 added lazy linking support, enabling support for linking against static libraries like mingwex, 8.0.1 fixed relocation issues, library search paths were expanded etc. 8.0.2 added import libraries support and better handling of object files. 8.2 will add better support for dynamicly linked libraries
Phyx- 2017-02-05 10:04:15
and 8.4 will add full dynamic linking support so GHC itself can switch to dynamicly linked libraries, after this we can adopt the same linking procedures as the unix codebase
Phyx- 2017-02-05 10:04:42
the problem is though, you still need to properly configure your searchpath
lyxia 2017-02-05 10:05:04
eschnett: it's not bound
sm 2017-02-05 10:05:38
Phyx-: this all sounds very good, but I think it's concerned with linking - the advice to choose pure haskell deps if you want your app to build easily on windows is still valid, yes ?
lyxia 2017-02-05 10:05:48
eschnett: you could write data Ap g x where... and not change the other variables.
lyxia 2017-02-05 10:06:16
eschnett: or even data Ap_ _ where
lyxia 2017-02-05 10:07:13
The type signatures of constructors are independent
eschnett 2017-02-05 10:07:31
lyxia: oh, thanks. apparently i need to re-read about data syntax.
Tuplanolla 2017-02-05 10:07:51
That only applies to `GADTSyntax` though, eschnett.
lyxia 2017-02-05 10:08:12
Ap :: forall a b. f a -> Ap f (a -> b) -> Ap f b
Phyx- 2017-02-05 10:08:15
sm: not really, linking *is* the major sore point. If you have a library that's portable, then it should work. A lot of difficulties people have had in the past is linking. When I try to build hackage, i hit two issues mostly. Linking and the use of the unix package
Phyx- 2017-02-05 10:09:19
sm: I can't do anything about B, but A has gotten significantly better. THat said, it's true that a lot of libraries are simply untested on Windows, mostly because their writers couldn't get it to work before.
Phyx- 2017-02-05 10:09:30
oh and 8.4 will add support for statically linked C++ code
sm 2017-02-05 10:09:35
Phyx-: what about, say http://hackage.haskell.org/package/regex-pcre. Will stack install regex-pcre work ?
sm 2017-02-05 10:10:03
are you working on making this better ? if so, thank you!
Phyx- 2017-02-05 10:13:17
sm: if pcre is installed then yes, likely you'll have to do "pacman -S mingw-w64-(uname -m)-pcre"
Phyx- 2017-02-05 10:13:40
but after that it should work if stack has it's include and lib directories setup correctly, which I assume they have
Phyx- 2017-02-05 10:13:50
I don't use stack so can't say much about it
sm 2017-02-05 10:14:04
how about cabal install regex-pcre ?
sm 2017-02-05 10:14:27
it sounds more doable than in the past, but still definitely not "just works"
sm 2017-02-05 10:14:51
or "well documented and understood"
Phyx- 2017-02-05 10:15:56
both suffer the same issue really. The biggest question is how to install and find these libraries. if you use stack you have msys2 and pacman. if you use cabal, you have to specify a place to look.
Phyx- 2017-02-05 10:16:14
though this is an issue for *all* compilers on Windows, not just GHC
sm 2017-02-05 10:16:18
sure
sm 2017-02-05 10:16:45
well good to know about stack providing pacman, I wasn't sure about that
sm 2017-02-05 10:17:23
it sounds like windows haskellers could write up a pretty reliable how-to for installing many popular C-based hackage packages
sm 2017-02-05 10:17:51
ie, paste these 3-4 commands and it will work
fendor 2017-02-05 10:18:13
hey, i got another question, what would good learning materials for haskell?
sternmull 2017-02-05 10:18:57
fendor: I spend the last two days reading the wikibook and found it really good.
sternmull 2017-02-05 10:19:14
this one: https://en.wikibooks.org/wiki/Haskell/
sternmull 2017-02-05 10:20:18
...and just a few minutes ago i found out that atom with the "haskell-ide" plugin works really nice. The fun can go on.
fendor 2017-02-05 10:20:56
sternmull: ok, do they also have an oppurtunity to test your knowledge? i read the book "learn yourself a haskell for great good" but i'd like to do some things on my own too?
sternmull 2017-02-05 10:21:33
fendor: Yes, there are exercises.
fendor 2017-02-05 10:21:45
well, "haskell-ide" fails sometimes terribly and in combination with ghc-mod, if you want to edit a file without a .cabal file, loads of error messages pop up
fendor 2017-02-05 10:22:29
switched to visual studio code for that reason, although the initial problem persists but isn't as invasive as the atom plugin
sternmull 2017-02-05 10:22:33
fendor: But to be honest i skipped the most of the exercises when i was sure i understood it... was impatient to learn the rest.
fendor 2017-02-05 10:23:12
yeah, me too, switiching the topics all the time, but i guess i should more focus on one topic
ertes 2017-02-05 10:23:51
fendor: https://www.seas.upenn.edu/~cis194/spring13/lectures.html
sternmull 2017-02-05 10:23:56
fendor: I tested Atom only for a few minutes now. But so far everything works perfectly: Highlighting, auto-completion, building, linting, ... really nice.
ertes 2017-02-05 10:24:17
fendor: and if that's too easy, there is also the NICTA course, or alternatively: just start doing something with haskell
ertes 2017-02-05 10:24:20
start a project
reactormonk 2017-02-05 10:24:42
I've got something with lenses lying around, if you wanna tinker with it.
fendor 2017-02-05 10:24:47
yeah, working on it, connect-four, but i lack of an idea of how the architecture should look like
ertes 2017-02-05 10:24:48
at some point you have to make the transition from "i'm learning" to "i'm using" =)
fendor 2017-02-05 10:25:54
i already am using it, i just love it, im studying computer science for 4 years now and for everything not related to university, i use haskell, but i want to extend my knowledge to practical projects
fendor 2017-02-05 10:26:59
ok, can someone explain to me, how i can answer directly? :D never used irc before
sternmull 2017-02-05 10:27:01
fendor: You could pick some existing interesting project and hack around in it. Maybe you discover new interesting approaches this way.
ertes 2017-02-05 10:27:06
fendor: then what would you like to learn? at this point it's your choice
Koterpillar 2017-02-05 10:27:19
fendor: like this
fendor 2017-02-05 10:27:42
just the name followed by a colon?
ertes 2017-02-05 10:27:42
fendor: perhaps pick up a web framework and write a web app, or pick up an FRP framework and do something interactive
Tuplanolla 2017-02-05 10:27:51
You just refer to another person by name, fendor. It's like real life but better.
fendor 2017-02-05 10:28:08
would reactive banana be a good start for an frp framework?
ertes 2017-02-05 10:28:23
fendor: also hint: type "Kote" and hit tab
ertes 2017-02-05 10:28:38
fendor: yes, reactive-banana is an excellent FRP framework
sternmull 2017-02-05 10:28:44
fendor: Antoher thing that helped me is to find haskell-implementations of problems/algorithms that i know. So i know what they do and can learn how to implement them in haskell.
fendor 2017-02-05 10:28:47
ertes: oh nice, thanks a lot
fendor 2017-02-05 10:30:07
ertes: so, yesod would be good idea, wouldnt it? I tried it a while back, but i had a lack of ideas of what i could create
fendor 2017-02-05 10:30:27
sternmull: you mean for example to implement my own AVL tree?
sternmull 2017-02-05 10:31:12
fendor: for me it was stuff like astar or path-tracing. Simple algorithms for which i was curious how an haskell implementation would look like.
fendor 2017-02-05 10:32:24
sternmull: so also BFS and DFS on a graph?
sternmull 2017-02-05 10:33:15
fendor: Stuff like that, yes. Whatever you are interested in.
fendor 2017-02-05 10:34:08
sternmull: ok thanks, i will think about it
fendor 2017-02-05 10:34:39
but still, the overall question was, are there conventions on how the architecture of a haskell program should look like?
fendor 2017-02-05 10:35:01
would the elm architecture be an easy and good enough architecture?
monochrom 2017-02-05 10:35:03
sternmull: My http://www.vex.net/~trebla/haskell/forwardconstraint/ForwardConstraint.html (there is a "Source" link at the top right corner)
monochrom 2017-02-05 10:35:42
Marvel at my exemplary doc-to-code ratio!
ertes 2017-02-05 10:36:38
fendor: personally i don't like yesod, because it relies so much on magic that i have no idea what's really going on
sternmull 2017-02-05 10:36:46
monochrom: I am not sure what i am looking at... do you show this to me because it could be used for graph search stuff?
ertes 2017-02-05 10:36:58
fendor: currently i'd go for snap or, in simpler cases, even scotty
fendor 2017-02-05 10:38:26
ertes: what exactly you didnt like? i read the introductions and it seemed really cool, of course magic, but still fun stuff, lucius and julius and hamlet. Can i use them too in scotty and snap? And why would you recommend the other two?
ertes 2017-02-05 10:39:40
fendor: i prefer the compositional design of snap over the monolithic design of yesod
ertes 2017-02-05 10:40:03
yesod: "integrate everything"
ertes 2017-02-05 10:40:08
snap: "compose me with everything"
fendor 2017-02-05 10:41:11
ok thank you for the tips, i will look into it right now
ertes 2017-02-05 10:41:30
back when i was using yesod i couldn't even figure out how subsites work properly, because there was so much magic involved that i couldn't just look at the types
fendor 2017-02-05 10:41:32
*i am going to look into it
fendor 2017-02-05 10:41:43
yeah, the types are terrible
boojinks 2017-02-05 10:41:57
hey all, are there any libraries that give a similar feel to BeautifulSoup?
geekosaur 2017-02-05 10:41:58
hamlet only requires wai/warp and can be used with pretty much everything. there's an adaptor for happstack, other stuff you iirc just plug whamlets in at the warp level
fendor 2017-02-05 10:42:02
but i think purescript's typesystem is almost worse
ertes 2017-02-05 10:42:45
yeah, shakespeare templates work with everything, but then again: the magic seems unnecessary, so i'd rather go with something compositional like lucid and clay
fendor 2017-02-05 10:42:53
geekosaur: i read all this template librarys can be used with almost every web framework, is that right?
ertes 2017-02-05 10:42:58
and jmacro, if you need javascript… or even GHCJS
geekosaur 2017-02-05 10:43:27
fendor, mostly. again. most of it plugs in at the warp/wai level, which underlies almost every web framework
fendor 2017-02-05 10:43:27
ertes: lucid and clay are template languages as well?
fendor 2017-02-05 10:43:42
geekosaur: ok cool, thx!
ertes 2017-02-05 10:43:54
fendor: they are combinator libraries for constructing HTML and CSS respectively
fendor 2017-02-05 10:44:21
they are also checked at compile time, i suppose?
ertes 2017-02-05 10:44:26
p_ ("Heed my " <> em_ "emphasised words!")