liste 2017-03-02 23:46:43
fclabels and data-lens are not compatible with 'lens' AFAIK
bennofs 2017-03-02 23:47:40
liste: yeah but those are not so popular neither, are they?
liste 2017-03-02 23:47:55
not anymore at leawt
liste 2017-03-02 23:47:58
least*
liste 2017-03-02 23:50:27
40 hackage packages depend on fclabels, 34 on data-lens, 14 on lens-family and 704 on lens
Rodenbach 2017-03-02 23:50:58
bennofs: ah okay, so in some cases the alternative libs offer what is needed for my specific case, and their selling point is that they introduce fewer deps. Oki, makes sense, thx.
John[Lisbeth] 2017-03-02 23:52:19
I hate to interject but this is album is named after a haskell joke: https://www.youtube.com/watch?v=Iozs9yOztQA
John[Lisbeth] 2017-03-02 23:52:39
or maybe even not
Taneb 2017-03-02 23:53:33
John[Lisbeth], if it is I do not recognize it
John[Lisbeth] 2017-03-02 23:54:20
if https://www.youtube.com/watch?v=RqvCNb7fKsg
nbro 2017-03-03 00:10:38
Hi!
ski 2017-03-03 00:10:50
hello again nbro
nbro 2017-03-03 00:11:20
playing again with Haskell…
mekeor 2017-03-03 00:11:51
already? it's not even weekend yet... ;P
zuck007 2017-03-03 00:12:07
?src
lambdabot 2017-03-03 00:12:07
src . Display the implementation of a standard function
zuck007 2017-03-03 00:12:18
?src (map)
lambdabot 2017-03-03 00:12:19
Source not found. Maybe you made a typo?
mekeor 2017-03-03 00:12:26
?src map
lambdabot 2017-03-03 00:12:27
map _ [] = []
lambdabot 2017-03-03 00:12:27
map f (x:xs) = f x : map f xs
zuck007 2017-03-03 00:13:01
?filter
lambdabot 2017-03-03 00:13:01
Unknown command, try @list
zuck007 2017-03-03 00:13:01
?src filter
lambdabot 2017-03-03 00:13:01
filter _ [] = []
lambdabot 2017-03-03 00:13:01
filter p (x:xs)
lambdabot 2017-03-03 00:13:01
| p x = x : filter p xs
lambdabot 2017-03-03 00:13:01
| otherwise = filter p xs
zuck007 2017-03-03 00:13:10
?src $
lambdabot 2017-03-03 00:13:10
f $ x = f x
nbro 2017-03-03 00:13:45
I've an exercise where it's required to bind specifically an Integer to a variable and then produce a square root of that Integer… I'm not 100% sure if functions can also be considered expressions, I guess, yes
nbro 2017-03-03 00:14:26
sorry, I didn't express myself in the best wa
nbro 2017-03-03 00:14:28
*way
nbro 2017-03-03 00:14:50
it's required to bind the Integer to a variable in an expression
AndreasK 2017-03-03 00:15:00
nbro: Probably wants you to define a lambda expression
ski 2017-03-03 00:15:34
or possibly even a named function
AndreasK 2017-03-03 00:16:24
Yeah it's not that well worded
nbro 2017-03-03 00:16:41
I thought to create a function by declaring explicitly also its type, e.g. f :: Integer -> Double; f x = sqrt(fromInteger(x))
nbro 2017-03-03 00:17:07
but, at this point, I would have a question: what isn't an expression in Haskell?
ski 2017-03-03 00:17:29
`f x = sqrt(fromInteger(x))' isn't an expression (it's a defining equation)
ski 2017-03-03 00:18:00
`f :: Integer -> Double' isn't an expression (it's a type signature)
ski 2017-03-03 00:18:19
neither `f x', nor `f' nor `x' in `f x = sqrt(fromInteger(x))' are expressions either (they are patterns)
nbro 2017-03-03 00:18:31
here https://www.haskell.org/onlinereport/exps.html it's written that type signature are expressions
ski 2017-03-03 00:19:16
(i.e. talking about the `x' on the left of `=', in the definiendum, the "thing to be defined"; as opposed to the right of `=', the "definiens", what it's being defined as)
ski 2017-03-03 00:19:27
that's type ascriptions
ski 2017-03-03 00:20:07
(unfortunately the report doesn't use separate terminology here)
nbro 2017-03-03 00:20:25
ok
nbro 2017-03-03 00:21:55
but, at this point, if a function definition isn't an expression, then what could they actually mean by "An expression that binds a variable x to an Integer, then evaluates to the square of x."?
ski 2017-03-03 00:21:56
.. anyway, one way of interpreting your exercise (given what you've said here) might be that you're to find the square root, without using the library `sqrt' operation (or say any other operation involving floating-point numbers)
ski 2017-03-03 00:22:44
nbro : interpreting that literally, what AndreasK said
ski 2017-03-03 00:23:24
.. have you seen function expressions/abstractions (aka "lambda expressions/abstractions") yet ?
nbro 2017-03-03 00:25:35
well, not in class, but I've already had a look at the syntax of lambda expressions, like (\x -> sqrt(x))?
ski 2017-03-03 00:26:02
ok, *nod*
ski 2017-03-03 00:26:48
nbro : another interpretation of "An expression that binds a variable x to an Integer, then evaluates to the square of x." would be a `let'-`in' expression ..
nbro 2017-03-03 00:27:56
@ski the previous exercise was (I know this are stupid exercises): "An expression that binds a variable x to a number (using let), then evaluates to the square of x.". So here they were specifically requiring us to use the let .. in .. with any number..
lambdabot 2017-03-03 00:27:57
Maybe you meant: wiki src ask
tabaqui1 2017-03-03 00:27:58
Just 1 <|> Just 2
tabaqui1 2017-03-03 00:28:01
>Just 1 <|> Just 2
tabaqui1 2017-03-03 00:28:03
> Just 1 <|> Just 2
lambdabot 2017-03-03 00:28:06
Just 1
tabaqui1 2017-03-03 00:28:16
:t some $ Just 1
lambdabot 2017-03-03 00:28:18
Num a => Maybe [a]
tabaqui1 2017-03-03 00:28:24
head $ some $ Just 1
tabaqui1 2017-03-03 00:28:27
> head $ some $ Just 1
lambdabot 2017-03-03 00:28:32
error:
lambdabot 2017-03-03 00:28:32
• Couldn't match type 'Maybe' with '[]'
lambdabot 2017-03-03 00:28:32
Expected type: [[a]]
tabaqui1 2017-03-03 00:28:37
> head <$> some $ Just 1
lambdabot 2017-03-03 00:28:41
error:
lambdabot 2017-03-03 00:28:41
• Couldn't match type '[a]' with 'Maybe Integer'
lambdabot 2017-03-03 00:28:41
Expected type: Maybe Integer -> [a]
ski 2017-03-03 00:29:08
tabaqui1 : perhaps you could speak to lambdabot in private, at least until you're satisfied with a lambdabot query you'd like to show the channel ?
tabaqui1 2017-03-03 00:29:35
ski: I want to demonstrate it first
ski 2017-03-03 00:29:55
you want to demonstate typos and error messages ?
tabaqui1 2017-03-03 00:30:02
here
tabaqui1 2017-03-03 00:30:07
> head <$> some (Just 1)
lambdabot 2017-03-03 00:30:14
mueval-core: Time limit exceeded
tabaqui1 2017-03-03 00:30:22
some (Just 1) returns Maybe [Int]
tabaqui1 2017-03-03 00:30:39
but it cannot be used even in lazy way
ski 2017-03-03 00:30:45
correct
tabaqui1 2017-03-03 00:30:53
what's the purpose of Alternative class?
ski 2017-03-03 00:31:10
it's often used with parsers
tabaqui1 2017-03-03 00:31:33
empty and <|> seem fine
ski 2017-03-03 00:31:39
> some Nothing
lambdabot 2017-03-03 00:31:43
Nothing
tabaqui1 2017-03-03 00:31:52
but some and many cannot be evaluated at all
tabaqui1 2017-03-03 00:32:11
> some [] :: [[Int]]
ski 2017-03-03 00:32:13
`some' will retry until the action fails. `Just 1' never fails, so it's retry infinitely many times
lambdabot 2017-03-03 00:32:14
[]
novakboskov 2017-03-03 00:32:50
Is it possible to provide "bare" switches from https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html#compiler-options-for-profiling to stack build command? It looks to me like stack build --executable-profiling --library-profiling somehow provides -fprof-cafs to ghc and I don't want it.
ski 2017-03-03 00:33:21
however, the type indicates that it *might* fail, so it can't return a `Just (...)' answer before it has found the first failing execution of the action -- which will never happen in this case
tabaqui1 2017-03-03 00:33:41
but it is still useless with pure types
ski 2017-03-03 00:33:56
i don't know what "pure types" mean
tabaqui1 2017-03-03 00:34:02
yeah, "some . print" do something
ski 2017-03-03 00:34:11
`IO' is just as pure as `Maybe'
tabaqui1 2017-03-03 00:34:29
ghc evaluate (return 1) each time
tabaqui1 2017-03-03 00:34:40
even if it gain us the same result
ski 2017-03-03 00:34:42
as is `StateT Foo Maybe'
tabaqui1 2017-03-03 00:35:54
there is no reason to check "some $ Just 1"
ski 2017-03-03 00:35:58
nbro : with any number, or with a specific number (possibly of your choosing) ?
tabaqui1 2017-03-03 00:35:58
if it doesn't fail once, it doesn't fail anytime
ski 2017-03-03 00:35:58
`some' can't know that
ski 2017-03-03 00:36:58
`some' is just a general function written in terms of `(<|>)'
tabaqui1 2017-03-03 00:37:00
still can't imagine code with "some $ Just smth
ski 2017-03-03 00:37:17
it doesn't seem very useful, no
nbro 2017-03-03 00:37:51
@ski : I'm not sure. Since function definitions are not expressions, then I interpreted ""An expression that binds a variable x to a number (using let), then evaluates to the square of x." as something like "myexp = let x = 3 in sqrt(x)", so I'm in reality binding x to a specific number (but not strictly an Integer)...
lambdabot 2017-03-03 00:37:52
Maybe you meant: wiki src ask
ski 2017-03-03 00:38:01
however, `(<|>)' is still useful on `Maybe'
tabaqui1 2017-03-03 00:38:26
yeah, these function can be applicable
tabaqui1 2017-03-03 00:38:35
except of some/many
ski 2017-03-03 00:39:32
nbro : fyi, it's not IRC custom to prefix the nickname of a person with `@', when addressing them. (also lambdabot gets confused, as you see). it's traditional to begin the message with the nickname in question, directly, followed e.g. by a colon or a comma, then the message
ski 2017-03-03 00:40:21
nbro : many IRC clients (by default) highlight/alert the user when someone addresses them in that way. not as many do that when the nickname is not eh very first thing in the message, though
ski 2017-03-03 00:41:08
nbro : again, since it says "square of x", not "square root of x", i doubt very much that you're to use `sqrt' at all
tabaqui1 2017-03-03 00:41:09
"/query nick" opens the new channel
tabaqui1 2017-03-03 00:41:11
btw
nbro 2017-03-03 00:41:23
ski: yes, sorry for that, I realized I was mentioning differently other people with respect to the other times… I may have got confused since in few certain other forums they usually use @
tabaqui1 2017-03-03 00:41:34
but channels don't handy in many clients
ski 2017-03-03 00:41:50
(IRC predates those forums)
nbro 2017-03-03 00:43:06
ski: yes, you're right, I should not be using sqrt but x*x
ski 2017-03-03 00:43:15
> 5^2
lambdabot 2017-03-03 00:43:18
25
ski 2017-03-03 00:43:28
> x^2
lambdabot 2017-03-03 00:43:31
x * x
nbro 2017-03-03 00:43:32
what
nbro 2017-03-03 00:43:33
lol
nbro 2017-03-03 00:43:41
ahah
nbro 2017-03-03 00:43:46
what's happening to me
nbro 2017-03-03 00:43:47
?
nbro 2017-03-03 00:43:48
ahah
brynser_ 2017-03-03 00:43:55
> x ** 3
lambdabot 2017-03-03 00:43:59
x**3
ski 2017-03-03 00:44:44
(perhaps aka "having fun", depending on circumstances)