This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-* | |
sudo sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collator = new RuleBasedCollator("< b < a"); | |
var strings = List.of("aaa", "bbb", "ccc", "aba"); | |
var sortedStrings = strings.stream() | |
.sorted(collator::compare) | |
.toList(); | |
System.out.println(sortedStrings); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var strings = List.of("aaa", "bbb", "ddd", "ccc", "aba"); | |
var sortedStrings = strings.stream().sorted().toList(); | |
System.out.println(sortedStrings); | |
// => [aaa, aba, bbb, ccc, ddd] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
concat = foldr mappend empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getSum ( Sum 1 `mappend` Sum 2 ) -- this returns 3 | |
getProduct ( Product 5 `mappend` Product 10 ) -- this returns 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instance Num a => Monoid (Product a) where | |
mempty = Product 1 | |
Product x `mappend` Product y = Product (x * y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Product 1 | |
Sum 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newtype Sum a = Sum { getSum :: a } | |
newtype Product a = Product { getProduct :: a } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Monoid m where | |
mempty :: m | |
mappend :: m -> m -> m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Person = Person { | |
name :: String, | |
surname :: String, | |
age :: Int | |
} |
NewerOlder