« first day (287 days earlier)      last day (1676 days later) » 

W W
4:02 PM
Is there a way I can perform equality using only named functions? i.e. no operators?
And preferably no imports as well
 
4:26 PM
@WW What kind of data are you doing equality on? If it is numbers you can use subtraction and pattern matching
 
W W
I am doing numbers, but it needs to be point free
Doing this btw
(without comments)
Just need a way of doing equality
If I could make equals out of more complex functions I'd be set
 
@WW can you do something with compare and toEnum and fromEnum?
 
W W
I'm not sure I catch your drift
 
compare returns an Ordering, I think you want a Bool, thay are both instances of Enum
 
W W
Oh yeah, hum
 
4:38 PM
you may also need subtract 1 and abs depending on how you do things
 
W W
Does TIO use an old version of ghc?
 
8.2 I believe on TIO
8.4 is current
 
W W
That sucks, means I can't use <> on TIO
 
@WW just import it and mention why like oerjan did in for his quine
 
W W
Is it from Data.Monoid?
 
4:43 PM
Data.Semigroup, but the one in Data.MOnoid is probably sufficient
 
W W
The fromEnum route is hard, but I think it is better than my semigroup route
Ok, I don't think the type system is going to allow that ether.
I need to go back to the drawing board
 
why is the type system not going to allow it? Ambiguous type?
 
W W
yeah
 
is the ambiguity on the Bool side?
 
W W
It claims compare is ambiguos, I hadn't got to the bool yet
n=fmap fromEnum
m=fmap n compare
 
4:53 PM
can I see the expression?`
 
W W
That was it
Hm, this is really hard
 
hmm, n should be a list of ints or somehtin glike that
 
W W
n? Its a function
 
no that is wrong, n is a function
 
W W
fmap is the same as (.) on functions
 
4:58 PM
wgat type is the fmap meant to be used at?
 
W W
fmap :: (Functor f) => (a -> b) -> f a -> fb iirc
yes
 
yes, but what is the intended f
 
W W
(Enum a)=> (a ->)
But it doesn't like that a is not a single type
Ah I have an idea
 
shouldn't fromEnum be the second parameter if you want that type
 
W W
I thiink so
Oh yes
Maybe not. I'm confusing myselt
-- | @since 2.01
instance Functor ((->) r) where
    fmap = (.)
So fmap is identical to (.), thus fromEnum should be first
My type analysis was wrong
the functor is of type (Ord a) => (a ->)
 
5:05 PM
overall we want input -> Ordering -> Int -> Bool, right?
 
W W
yeah
 
shouldn't the first thing we apply be compare?
 
W W
yeah it is
my code is the same as m = (fromEnum .) . compare
m = fmap (fmap fromEnum) compare
Oh, god.
I can just use /=
 
I think it might be the monomorphism restriction tio.run/…
 
W W
Ok, I got around it. Thanks for all the help though. It's nice to have someone helping
 
5:18 PM
I'll go back to learning Agda now
 

« first day (287 days earlier)      last day (1676 days later) »