Koterpillar 2017-02-19 16:45:43
> let groupish f x y = sortBy (flip elemIndex y . f) x y in groupish (\x -> x `mod` 10) [1..100] [1..10]
lambdabot 2017-02-19 16:45:46
error:
lambdabot 2017-02-19 16:45:46
• Couldn't match expected type '[a1] -> t1' with actual type '[a]'
lambdabot 2017-02-19 16:45:46
• The function 'sortBy' is applied to three arguments,
Koterpillar 2017-02-19 16:46:01
> let groupish f x y = sortBy (flip elemIndex y . f) x in groupish (\x -> x `mod` 10) [1..100] [1..10]
lambdabot 2017-02-19 16:46:04
error:
lambdabot 2017-02-19 16:46:04
• Couldn't match type 'Maybe Int' with 'a1 -> Ordering'
lambdabot 2017-02-19 16:46:04
Expected type: a1 -> a1 -> Ordering
kadoban 2017-02-19 16:46:36
Koterpillar: How could elemIndex be correct though? Doesn't that just give you the first element that matches?
Koterpillar 2017-02-19 16:46:59
> let groupish f x y = sortBy (compare `on` (flip elemIndex y . f)) x in groupish (\x -> x `mod` 10) [1..100] [1..10]
enthropy 2017-02-19 16:47:00
probably sortOn would typecheck
lambdabot 2017-02-19 16:47:02
[10,20,30,40,50,60,70,80,90,100,1,11,21,31,41,51,61,71,81,91,2,12,22,32,42,5...
Koterpillar 2017-02-19 16:47:18
kadoban: you're right
romanandreg 2017-02-19 16:48:35
Hey, do you know if there is a way to have a .ghci file per project?
kadoban 2017-02-19 16:48:38
enthropy: IMO your basic idea seems right. It's possible you can do this via group or sort or something, but ... I'm not seeing it.
Axman6 2017-02-19 16:48:50
romanandreg: yes, just put it in the root of the project
romanandreg 2017-02-19 16:48:54
I'm just trying a .ghci file that defines some :cmd in the top of a project dir with no luck
Axman6 2017-02-19 16:49:13
is it in the directory you're executing ghci from?
romanandreg 2017-02-19 16:49:21
s/:cmd/:def/
romanandreg 2017-02-19 16:49:34
I'm using Stack
romanandreg 2017-02-19 16:49:39
from intero's mode
romanandreg 2017-02-19 16:49:47
so, not sure if that would skew it up
romanandreg 2017-02-19 16:50:39
yeah, it is likely, GHCi is not running at the top of the project when running inside emacs
Koterpillar 2017-02-19 16:50:56
is it even GHCi running?
romanandreg 2017-02-19 16:52:28
I think so
romanandreg 2017-02-19 16:52:56
this gives me the impression intero ignores .ghci file on purpose => https://github.com/commercialhaskell/intero/blob/adb30bfcd4b280005dc6bf505cb9ff0326f7fbc5/src/test/Main.hs#L503
romanandreg 2017-02-19 16:53:05
:(
Koterpillar 2017-02-19 16:53:48
this is a test file
Koterpillar 2017-02-19 16:54:00
https://github.com/commercialhaskell/intero/commit/80707d2db2ee8e73c5aaaa62ecde9c6959f4c320
Koterpillar 2017-02-19 16:55:53
but see https://github.com/commercialhaskell/intero/issues/355
geekosaur 2017-02-19 16:56:51
romanandreg, arguments can be made in both directions, personally I suspect it'd be better to have a project specific file and let .ghci be solely for interactive use
geekosaur 2017-02-19 16:57:25
(or possibly a stanza in cabal file / stack.yaml as appropriate)
enthropy 2017-02-19 16:58:33
thanks Koterpillar and kadoban
romanandreg 2017-02-19 17:08:35
geekosaur: what you mean with a stanza?
geekosaur 2017-02-19 17:09:23
I mean whatever the appropriate syntax is for each one
geekosaur 2017-02-19 17:10:05
like a ghci-options: (or intero-ghci-options: or whatever) in the cabal file, or the equivalent YAML
romanandreg 2017-02-19 17:21:12
Oh, the reason why it was not working is because of the file mod of the project directory
romanandreg 2017-02-19 17:21:25
if it can be read by others, GHCi won't load the .ghci file
lpaste_ 2017-02-19 17:41:19
threshold pasted "Requesting help with Servant" at http://lpaste.net/352744
Koterpillar 2017-02-19 17:42:26
threshold: liftIO?
Axman6 2017-02-19 17:44:40
pretty sure you do not want to be running getArgs for every request...