SexHendrix 2017-03-09 05:46:09
in it for the 1337 hostmasks
felko 2017-03-09 05:48:04
Is there anyway of using a type-level Nat as a value in a computation ? I can't find anything online
ertes 2017-03-09 05:49:25
felko: on the type level or value level?
cocreature 2017-03-09 05:49:47
KnownNat allows you to get the value corresponding to a type-level nat
glguy 2017-03-09 05:51:57
felko: You can use the KnownNat class
felko 2017-03-09 05:52:21
ok i'll check it out thanks
ertes 2017-03-09 05:52:21
felko: for type-level computation you can use the type families like (+) from the GHC.TypeLits module
felko 2017-03-09 05:52:21
ertes: i meant using a type-level Nat in a value-level computation
felko 2017-03-09 05:52:21
Ok KnownNat seems to correspond to what I want, thanks a lot
kubunto 2017-03-09 05:52:21
ok i cant figure this out
kubunto 2017-03-09 05:52:21
i have a string of punctuation that i want to remove
kubunto 2017-03-09 05:53:06
function is http://lpaste.net/353349
shapr 2017-03-09 05:54:38
> filter (not . flip elem "'!") "I don't want punctuation!"
lambdabot 2017-03-09 05:54:47
"I dont want punctuation"
glguy 2017-03-09 05:54:50
kubunto: Do you know that this "\[x] -> ..."
glguy 2017-03-09 05:54:53
is matching single element lists?
kubunto 2017-03-09 05:54:56
glguy: no but it matches what i have observed
cocreature 2017-03-09 05:55:10
maybe start by adding a type signature :)
ertes 2017-03-09 05:55:17
kubunto: you should really write a type signature for both 'replace' and 'replacef'
glguy 2017-03-09 05:55:38
In this context [x] is a pattern for a single element list where the single element is named x
glguy 2017-03-09 05:56:19
like the list: [1] or [True]. It's different from the type level where you have [Int] which means "a list of Ints"
`Guest03 2017-03-09 05:59:15
tfc: (not <$>) . f
tfc 2017-03-09 06:00:46
`Guest03: nice, this works too. thx!
shapr 2017-03-09 06:01:39
tfc: lambdabot's @pl command is fun too
shapr 2017-03-09 06:01:40
@pl \x -> fmap not (f x)
lambdabot 2017-03-09 06:01:40
fmap not . f
glguy 2017-03-09 06:01:40
If we're obfuscating: (not <$>) <$> f
SexHendrix 2017-03-09 06:01:40
my favourite is
SexHendrix 2017-03-09 06:01:40
@protontorpedo
lambdabot 2017-03-09 06:01:40
so how do you use haskell tools to build large programs?
SexHendrix 2017-03-09 06:01:40
or maybe
SexHendrix 2017-03-09 06:01:40
@ghc
lambdabot 2017-03-09 06:01:40
Info table already?
shapr 2017-03-09 06:01:40
SexHendrix: yeah, that user had a surprising amount of surreality
ertes 2017-03-09 06:01:40
to (<$>) or not to (<$>): (<$>) (not (<$>)) f
SexHendrix 2017-03-09 06:01:56
im in a channel where some other lads are running a markov plugin on the entire log history
dolio 2017-03-09 06:02:13
protontorpedo is kind of boring. keal is better.
merijn 2017-03-09 06:02:32
@keal
SexHendrix 2017-03-09 06:02:33
so i like to spam @ghc in there to poison all output with sassy ghc quips
lambdabot 2017-03-09 06:02:33
b*(Floor[v/b^p]/b-Floor[Floor[v/b^p]/b])
ongy 2017-03-09 06:03:00
:t b*(Floor[v/b^p]/b-Floor[Floor[v/b^p]/b])
lambdabot 2017-03-09 06:03:02
error:
lambdabot 2017-03-09 06:03:02
• Data constructor not in scope: Floor :: [Expr] -> Expr
lambdabot 2017-03-09 06:03:02
• Perhaps you meant variable 'floor' (imported from Prelude)
ertes 2017-03-09 06:03:14
:t \f -> (id <*> not) (<$>) f
lambdabot 2017-03-09 06:03:17
error:
lambdabot 2017-03-09 06:03:17
• Couldn't match type 'Bool' with 'a -> b'
lambdabot 2017-03-09 06:03:17
Expected type: ((a -> b) -> f a -> f b) -> f a -> f b
kubunto 2017-03-09 06:03:51
brb
`Guest03 2017-03-09 06:04:53
:t x
lambdabot 2017-03-09 06:04:56
Expr
`Guest03 2017-03-09 06:05:04
> x + x
lambdabot 2017-03-09 06:05:09
x + x
ertes 2017-03-09 06:05:13
:t (id <*> not :: (forall f. (Functor f) => (a -> b) -> f a -> f b) -> [Bool] -> [Bool]) (<$>)
lambdabot 2017-03-09 06:05:15
error:
lambdabot 2017-03-09 06:05:15
• Couldn't match type 'Bool -> [Bool] -> [Bool]'
lambdabot 2017-03-09 06:05:15
with 'forall (f :: * -> *). Functor f => (a -> b) -> f a -> f b'
ertes 2017-03-09 06:07:32
@src (<$$>)
lambdabot 2017-03-09 06:07:32
Source not found.
ongy 2017-03-09 06:08:14
:t (<$$>(
ongy 2017-03-09 06:08:15
:t (<$$>)
lambdabot 2017-03-09 06:08:16
error:
lambdabot 2017-03-09 06:08:16
parse error (possibly incorrect indentation or mismatched brackets)
lambdabot 2017-03-09 06:08:18
error:
lambdabot 2017-03-09 06:08:18
• Variable not in scope: <$$>
lambdabot 2017-03-09 06:08:18
• Perhaps you meant one of these:
ertes 2017-03-09 06:08:28
lambdabot is not in tsunderebot mode today?
SexHendrix 2017-03-09 06:08:30
:t <$$$>
lambdabot 2017-03-09 06:08:32
error: parse error on input '<$$$>'
ongy 2017-03-09 06:09:04
you have to put operators in parens for things like this. so <$> becomes (<$>) and so forth
ertes 2017-03-09 06:09:54
where did i see (<$$>) = flip fmap? would be quite useful to have in Prelude
ongy 2017-03-09 06:09:59
same for import lists, so 'import Control.Applicative ((<$>))' is rather common for me
ertes 2017-03-09 06:10:02
:t (<**>) -- like this
lambdabot 2017-03-09 06:10:05
Applicative f => f a -> f (a -> b) -> f b
nitrix 2017-03-09 06:32:13
In which case, it simply becomes:
`Guest03 2017-03-09 06:32:27
(\c -> fromEither $ guard (isPunctuation c) *> return c <|> return ' ')
nitrix 2017-03-09 06:32:52
> filter (not . isPunctuation) "Hello, World!"
lambdabot 2017-03-09 06:32:54
"Hello World"
nitrix 2017-03-09 06:34:05
Oh I'm doing the same mistake.
teto 2017-03-09 06:34:05
any advice to a beginner for parsing CSV ?
`Guest03 2017-03-09 06:34:05
> concatMap (\c -> if (isPunctuation c) then " " else [c]) "1, 2, 3..."
lambdabot 2017-03-09 06:34:05
"1 2 3 "
sm 2017-03-09 06:34:46
teto: use one of the CSV libs on hackage ?
teto 2017-03-09 06:35:23
I hesitate between cassava and parsec ? any reason to choose one over the other ?
sm 2017-03-09 06:35:43
parsec doesn't come with a csv parser, you'd be writing it yourself
sm 2017-03-09 06:36:50
and that already exists (http://hackage.haskell.org/package/csv)
sm 2017-03-09 06:37:42
which is old, but very simple
teto 2017-03-09 06:39:17
thanks
JonReed 2017-03-09 06:39:42
Hi, is there a way to provide default value to a lens. E.g., this `aList ^? ix 0` returns maybe and I want it to return simply `a`. I know I can `fromMaybe 42 $ aList ^? ix 0 `, but what is the lens way of doing it?
Tuplanolla 2017-03-09 06:40:15
Yes, `non`, JonReed.
JonReed 2017-03-09 06:41:12
Tuplanolla: Can you provide an example, please? I tried non before and I used it somehow in a wrong way
Tuplanolla 2017-03-09 06:41:28
See Microlens' documentation for several examples, JonReed.
Tuplanolla 2017-03-09 06:41:33
@hackage microlens
lambdabot 2017-03-09 06:41:34
http://hackage.haskell.org/package/microlens
kubunto 2017-03-09 06:41:50
can i put type definitions inside a function?
Tuplanolla 2017-03-09 06:41:56
Yes, anywhere, kubunto.
Tuplanolla 2017-03-09 06:42:13
Wait, declarations or definitions?