Skip to content

Instantly share code, notes, and snippets.

strict digraph {
graph [layout=dot; overlap=false; rankdir=LR; nodesep=0.5];
subgraph types {
node [shape=oval];
Integer -> Rational [label="(%1)"];
}
subgraph classes {
node [shape=square];
edge [arrowhead=diamond; style=dashed];
Num;
@s9gf4ult
s9gf4ult / A.hs
Last active July 25, 2018 15:45
module A
makeEtherHasLens :: Name -> DecsQ
makeEtherHasLens name = do
TyConI dec <- reify name
fields <- case dec of
DataD _ctx _name _tvars _kind [dataCon] _derive -> case dataCon of
RecC _conName fs -> return $ (\(n, _bang, ty) -> (n, ty)) <$> fs
_ -> fail $ show name ++ ": hust have prefix constructor with named fields"
_ -> fail $ show name ++ ": must be one constructor record with named fields"

Что надо сделать перед релизом

Проверить собираемость с новым hackage

cabal update

убить песочницу и пересобрать

Запустить тесты

Проверить хакадж

Если предыдущая версия не скомпилировалась, на хакадже, то посмотреть почему это произошло и исправить.

Исходный код

fn main() {
let s = String::from("жопа");
let t : String = s.chars().skip(3).collect();
println!("{}", s);
println!("{}", t);
}
fn main() {
let s = String::from("жопа");
let t = & s[3..];
println!("{}", s);
println!("{}", t);
}
// thread 'main' panicked at 'byte index 3 is not a char boundary; it is inside 'о' (bytes 2..4) of `жопа`', src/libcore/str/mod.rs:1771
// note: Run with `RUST_BACKTRACE=1` for a backtrace.
@s9gf4ult
s9gf4ult / new flow.md
Last active September 22, 2017 09:54

1. Форма бронирования

На форму попадаем с поиска и предварительного бронирования. К моменту попадания на форму имеем сохраненный в базе офер и OfferId

1.1 Репрайс оффера

  • Пользователь меняет, или не меняет (тогда остается 0) extra markup

  • Жмет Add

{
"form": {
"offer": {
"flights": [
{
"flight_segments": [
{
"carriers": {
"operating": {
"code": "MR",
****** Как обрабатывается запрос
******* Book / Book & ticket
******** maxPrice <- Валидируем запрос
********* maxPrice <- Берем ожидаемую цену из запроса
********* Проверяем что maxPrice > offerPrice
********** Ошибка
*********** Возвращаем прайсинг из оффера в базе
********* return maxPrice
******** newPrice <- processBooking maxPrice
********* pricingAcceptable maxPrice
Как обрабатывается запрос
Book / Book & ticketmaxPrice <- Валидируем запросmaxPrice <- Берем ожидаемую цену из запросаПроверяем что maxPrice > offerPriceОшибкаВозвращаем прайсинг из оффера в базеreturn maxPricenewPrice <- processBooking maxPricepricingAcceptable maxPrice
seriousBusiness :: Trans IO Int
seriousBusiness = do
res1 <- doSomeAction
cleanupOnErrors res1 $ do
res2 <- doOtherAction
cleanupOnErrors res2 $ do
res3 <- doEvenMoreAction
cleanupOnErrors res3 $ do
return 42