maksim__ 2017-02-19 10:47:32
i'll give you guys this
maksim__ 2017-02-19 10:47:36
ghci is very powerful
pikajude 2017-02-19 10:53:46
maksim__: ok, i've got it building with stack
pikajude 2017-02-19 10:53:52
the project proper, not the Setup.hs
pikajude 2017-02-19 10:54:00
assuming the main difference is that i'm not using a custom package-db
pikajude 2017-02-19 10:54:35
although macOS Sierra has the naughty linker that can't understand GHC's load commands, so now I'm stuck
pikajude 2017-02-19 10:54:37
still curious though
Gedos 2017-02-19 10:56:15
Hi guys, trying to learn Haskell atm, but I got a problem with type signatures, anyone feel like helping out a newbie?
pikajude 2017-02-19 10:56:36
i gotta head home actually so i'll be back online in a bit
Cale 2017-02-19 10:57:00
Gedos: You should generally just ask your question on IRC
lpaste_ 2017-02-19 10:58:44
Gedos pasted "error message type sig" at http://lpaste.net/352730
Gedos 2017-02-19 10:59:27
With the following function
Gedos 2017-02-19 10:59:28
maxOppGeofigFromList :: [Geofig] -> [Geofig] maxOppGeofigFromList geofigs = filter (oppervlakte == maximum (map oppervlakte geofigs)) geofigs
Koterpillar 2017-02-19 11:00:00
:t filter -- Gedos
Gedos 2017-02-19 11:00:02
oppervlakte is a function with the signature Geofig -> Float
lambdabot 2017-02-19 11:00:08
(a -> Bool) -> [a] -> [a]
siddhu 2017-02-19 11:00:17
filter (\x -> oppervlakte x == maximum (map oppervlakte geofigs)) geofigs
siddhu 2017-02-19 11:00:19
does that work?
Gedos 2017-02-19 11:01:27
yes it worked @siddhu :D
Gedos 2017-02-19 11:01:42
I don't understand why this works though siddhu
siddhu 2017-02-19 11:03:47
when you do `filter null xs` its just secretly `filter (\x -> null x) xs`
Gedos 2017-02-19 11:04:15
Should i try to always use lambda expressions when using filter?
siddhu 2017-02-19 11:04:47
when starting out, might be good to start with a lambda expression, then see if you can remove it
Gedos 2017-02-19 11:05:26
alright got it, thanks a lot siddhu!
bitf 2017-02-19 11:06:09
hey everyone. i am an 'intermediate' beginner. confused. question:
bitf 2017-02-19 11:08:15
in a function like group, from Data.List...how come 'group []' returns [] instead of [[]]. isn't this type invalid? since the type for group is group :: Eq a => [a] -> [[a]]
Koterpillar 2017-02-19 11:09:16
:t [] -- bitf
lambdabot 2017-02-19 11:09:18
[t]
Koterpillar 2017-02-19 11:09:24
that's an empty list of anything
siddhu 2017-02-19 11:09:29
bitf: [] is an empty list of lists
Koterpillar 2017-02-19 11:09:29
including an empty list of lists
kadoban 2017-02-19 11:09:31
bitf: [] is an empty list of any type. Including the type of lists where the elements are other lists.
Koterpillar 2017-02-19 11:10:05
I think the promise of group is that all the elements of the returned list are non-empty, by the way
kadoban 2017-02-19 11:10:34
It in fact couldn't return [[]], because of the type of 'group'.
kadoban 2017-02-19 11:10:38
:t group
lambdabot 2017-02-19 11:10:40
Eq a => [a] -> [[a]]
kadoban 2017-02-19 11:11:09
All it knows is that the list elements are any type. It can't know that it can create an element with [] in this case, because the function is generic.
bitf 2017-02-19 11:11:16
":t [[]]" = [[]] :: [[t]]
Koterpillar 2017-02-19 11:11:27
kadoban: it can
bitf 2017-02-19 11:11:31
[] :: [t]
Koterpillar 2017-02-19 11:11:41
kadoban: :t [[]]
Koterpillar 2017-02-19 11:11:49
:t [[]] -- kadoban
lambdabot 2017-02-19 11:11:51
[[t]]
SrPx 2017-02-19 11:12:52
Is there any market to work with Haskell and ASICs nowadays? I'm really appreciating any link, reference you can give. This is for a friend which is quite depressed with his career choices ):
kadoban 2017-02-19 11:13:38
Hmm, ya you're right, that wasn't a well thought out thing.
siddhu 2017-02-19 11:14:50
SrPx: http://www.clash-lang.org/ ?
SrPx 2017-02-19 11:16:59
siddhu: thanks!!
bitf 2017-02-19 11:18:01
i've looked at the source code for group - and if i change the line groupBy _ [] = [] to groupBy _ [] = [[]] it doesn't make any difference
SrPx 2017-02-19 11:18:18
Completely unrelated note, I spent the last week writing a small project 100% in JavaScript, but pretty much following a Haskell style in a very extreme sense. I wanted it in JavaScript because I really, really wanted it to run on the browser and be fast/small
bitf 2017-02-19 11:18:19
but if it's changed to [[[]]] then there's a problem
Koterpillar 2017-02-19 11:19:20
SrPx: did you read http://mutanatum.com/posts/2017-01-12-Browser-FP-Head-to-Head.html by any chance?
SrPx 2017-02-19 11:19:30
A snippet, for your amazement: http://i.imgur.com/bHq1Pws.png
Koterpillar 2017-02-19 11:19:40
bitf: that's expected
SrPx 2017-02-19 11:19:46
So, after 1 week at this really weird experiment, twisting myself to tolerate functional javascript
SrPx 2017-02-19 11:19:53
I figure out that I need something that isn't available on the browser
SrPx 2017-02-19 11:20:03
so... it is all in node.js for no good reason
SrPx 2017-02-19 11:20:04
#fml
Koterpillar 2017-02-19 11:20:16
SrPx: this looks very much like code that PureScript/Elm would compile to
SrPx 2017-02-19 11:21:02
Yep but I specifically avoid PureScript which is really really awesome but I absolutely hate having an additional build step. I don't know, something about it just destroys my productivity. I'm not sure what, why
SrPx 2017-02-19 11:21:10
I've made some cool things in PureScript though
SrPx 2017-02-19 11:21:37
And Elm specifically, I avoid it because the type system had some weird bugs last time I used and was too unexpressive in general
Koterpillar 2017-02-19 11:21:42
and yet you're in a room for a compiled language
SrPx 2017-02-19 11:22:08
What room? I'll read your article now, brb
Tuplanolla 2017-02-19 11:22:17
I recently did the same thing with Octave, SrPx.
SrPx 2017-02-19 11:22:18
(oh)
dolio 2017-02-19 11:22:22
The room you're speaking in.
Koterpillar 2017-02-19 11:22:40
SrPx: the article isn't mine
SrPx 2017-02-19 11:23:03
"This is about purely functional programming, which means I'm not even going to consider a system valid without referential transparency and IO managed in some way. So yes, all flavors of Lisp are off the table as well."
SrPx 2017-02-19 11:23:08
so extremist
SrPx 2017-02-19 11:23:13
looking good
SrPx 2017-02-19 11:23:33
Koterpillar: the article you linked*
Gedos 2017-02-19 11:24:21
when using the map function, how do I refer to the element within the list to use as an argument for the function map will use?
Koterpillar 2017-02-19 11:24:54
> map (\x -> x + 1) [1,2,3] -- Gedos
lambdabot 2017-02-19 11:24:57
[2,3,4]
Gedos 2017-02-19 11:25:29
Thanks
Koterpillar 2017-02-19 11:25:51
> let thatThing x = x + 1 in map thatThing [1,2,3]
lambdabot 2017-02-19 11:25:54
[2,3,4]