Cooler 2017-02-18 05:55:59
for the Constant functor, why can't fmap map over the a type?
Cooler 2017-02-18 05:56:17
in data Constant a b = Constant a
Cooler 2017-02-18 05:56:56
actually its newtype Constant a b = Constant { getConstant :: a }
Cooler 2017-02-18 05:57:05
deriving (Eq, Show)
Welkin 2017-02-18 05:57:27
look at the Functor instance
Welkin 2017-02-18 05:57:35
it depends on how it is defined
geekosaur 2017-02-18 05:58:21
Cooler, the short reason is that the type variable to map over has to be the *last* one in the type definition
Welkin 2017-02-18 05:58:30
http://hackage.haskell.org/package/transformers-0.5.4.0/docs/src/Data-Functor-Constant.html#line-87
geekosaur 2017-02-18 05:58:32
it's the one that is "exposed"
Welkin 2017-02-18 05:59:11
I know that (,) is a common source of confusion for Functor as well
geekosaur 2017-02-18 05:59:48
(this is similar to how you can simplify `f a xs = ... xs` by removing the `xs` on both sides because it's at the end on both sides, but the `a` can't be moved the same way)
Cooler 2017-02-18 06:01:28
oh wait i think its because fmap :: (a -> b) -> f a -> f b and f a in this case is Constant x y where f = Constant x and a = y, and f b is Constant x z where b = z, so a -> b is y -> z which can't be applied to the pattern match of the data constructor Constant s where s :: x
Welkin 2017-02-18 06:04:34
it's not necessarily a technical reason
Welkin 2017-02-18 06:05:06
semantically, it is doing what a constant should
Welkin 2017-02-18 06:05:20
same with (,) as a (key-value) pair
tfc 2017-02-18 06:05:58
anyone here every used ghci with some shelly/hsh/whatever language as default shell?
Cooler 2017-02-18 06:06:39
Welkin, well not really, if you apply (+2) to the literal (constant) 2 (+2) 2 = 4
Welkin 2017-02-18 06:07:12
that's not the constant I'm talking about
Cooler 2017-02-18 06:07:14
Welkin, what you are thinking of is an eigen value
Cooler 2017-02-18 06:07:28
that doesn't change when put through a function
Welkin 2017-02-18 06:07:31
> const 2 4
lambdabot 2017-02-18 06:07:34
2
Welkin 2017-02-18 06:07:55
it will always produce a 2 no matter what
Cooler 2017-02-18 06:08:06
oh your talking about the function const
Cooler 2017-02-18 06:08:26
no we were discussing the newtype Constant
Welkin 2017-02-18 06:08:37
Constant is just a data representation of the same concept, isn't it?
Cooler 2017-02-18 06:08:55
yes
Cooler 2017-02-18 06:09:42
but it could also make sense in terms of literal constants like 2
Tuplanolla 2017-02-18 06:10:07
A literal actually follows the same concept, but it's actually "constant over universal quantification", Cooler.
SudhanshuJ 2017-02-18 06:10:42
My program takes Integers as input and returns a string based upon calculations that may be fractional
SudhanshuJ 2017-02-18 06:10:56
It doesn't compile however http://lpaste.net/352691
monochrom 2017-02-18 06:12:16
use fromIntegral on books too
SudhanshuJ 2017-02-18 06:15:12
SudhanshuJ 2017-02-18 06:16:05
maksim__ 2017-02-18 06:31:40
cocreature, did stack clean and build
maksim__ 2017-02-18 06:31:43
still can't run main
cocreature 2017-02-18 06:32:10
maksim__: sorry not sure what's going on then
cocreature 2017-02-18 06:32:20
maksim__: do you use the C ffi?
maksim__ 2017-02-18 06:32:23
yes
maksim__ 2017-02-18 06:33:00
cocreature, yes
cocreature 2017-02-18 06:35:07
maksim__: there were problems in the past with stack ghci and the C ffi, so opening a bugreport is probably the best you can do
fizbin 2017-02-18 06:38:12
Is anyone else using "cabal new-build" ? I am and I'm finding I have to wipe out the dist-newstyle directory every time
fizbin 2017-02-18 06:38:37
I switch from profiling to non-profiling builds. Am I doing something wrong?
cocreature 2017-02-18 06:40:11
fizbin: I haven't experienced that myself but I'm using git master instead of 1.24. you might want to try that as well