Если вы видите что-то необычное, просто сообщите мне. Skip to main content

Часть 1: Ослабление устрашающего взгляда Haskell

WelcomeДобро toпожаловать theв firstпервую partчасть ofсерии the"Мозги Haskell"! Кроме описанных базовых понятий в прошлой серии статей, остается еще много работы, которая требует изучения нового! Эта серия статей затрагивает психологиеческие барьеры людей встречающие изучение нового языка. И дает советы для преодоления проблем.

Первая часть будет иметь совй взгляд на Haskell, в большом сообществе программистов. Мы посмотрим почему Haskell Brainчасто series!воспринимается Whileкак ourпугающий Liftoffи Seriesтрудный, goesи overпочему theэто basicsне ofдолжно theвас actual language, there's also a lot of mental work that goes into learning anything new! This series will cover some of the psychological barriers people encounter when learning Haskell. It will also some tips for overcoming them.пугать.

ThisЕсли firstвы partбесстрашны willи takeхотите aпопасть specificс lookкорабля atна Haskell'sбал, reputationможно inдвигаться theсразу largerко programmingвторой community.статье. We'llТам examineмы whyобсудим текущие процессы изучения языка. если вы хотите перейти сразу к изучению и написанию кода, то пожалуйста.

Академический язык

Люди долго считали Haskell oftenв isосновном seenязыком asисследования. intimidatingОн andпостроен difficult,на andлябда whyвычислениях, thisвозможно shouldn'tнаипростейший, beчистейший theязык case!

программирования.

IfЭто you'reдает totallyогромное fearlessколичество andвозможностей wantсвязывания toс hopотличными straightидеями intoв someабстрактной techniquesматематике, forв learning,первую youочередь canдля moveстудентов, onпрофессоров toи partдокторов. 2Эта ofсвязь thisнастолько series.элегантна, There,что we'llматематические discussидеи theмогут actualбыть processлегко ofпредставленны learning. If you want to jump straight into learning the language and writing some code, make sure you download our Beginner's Checklist to help you with that!

AN ACADEMIC LANGUAGE

People have long considered Haskell primarily as a research language. It builds on the lambda calculus, possibly the simplest, purest programming language. This gives it a host of connections to cool concepts in abstract mathematics, primarily the province of professors and PhD. students. The connection is so elegant many mathematical ideas can be well represented inв Haskell.

ButНо thisэта connectionсвязь hasимеет aцену priceдоступа. inВажные accessibility. Importantидеи Haskell conceptsвключают includeфункторы, functors,монады, monads,категории categories,и etc.т.д. TheseОни areхороши, cool,но butтолько fewнекоторые withoutбез aматематической mathстепени degreeимеют haveпредставление anyчто intuitionзначат forэти whatпонятия. theСравним termsэти mean.понятия Compareс theseдругими toязыками: termsкласс, fromитератор, otherцикл, languages:шаблон. class,Эти iterator,гораздо loop,понятнее, template.и Theseязыки termsиспользуют areв aкачестве lot more intuitive, so the languages using them have an automatic advantage in accessibility.преимущества.

AsideОтходя fromот thisэтой terminologyтерминологии, pointбольшой though,академический theинтерес greatэто academicотличная interestвещь. isОднако, aна goodстороне thing,производства, notинструментарий aне badбудет thing.достаточный. However,Просто onсложно theобслуживать production side of things, the tooling has not been sufficient. It was simply too difficult to maintain a large-scaleбольшие Haskell project.проекты. AsКак aрезультат, result,компании companiesне hadимеют littleбольшого incentiveинтереса toиспользовать useего. it.Это Thisзначит, meantчто thereнет wasособого littleвлияния toна noакадемический balanceбаланс of the academic influence.языка.

KNOWLEDGEРаспространение DISTRIBUTIONзнания.

TheСетевые netрезультаты resultHaskell ofакадемического Haskell’sпервенства academicэто primacyперекошенная isбаза aзнаний. skewedВ knowledgeакадемии base.несколько Theчеловек natureпроводят ofмного academiaвремени isна thatотносительно relativelyмаленьких fewпроблемах. peopleУчитывая spendдругие aакадемические largeполя, amountкак ofвирусология. timeУ onвас aесть relativelyнекоторые smallэксперты setкоторые ofпонимаю problems.вирусы Considerна anotherдостаточно academicвысоком field,уровне, likeи virology.большинство Youне haveзнают someоб expertsэтом whoничего. understandНет virusesвирусологов-любителей. atК anсожалению, extremelyэтот highтип level,распространения andзнаний theнеблагоприятный restдля ofобучения usновых don'tлюдей know much at all. There are no hobbyist virologists. Unfortunately, this kind of distribution is not conducive to introducing new people to a topic.теме.

Naturally,Естественн, peopleлюди haveдолжны toобщаться learnс fromтеми, thoseкто whoзнает knowбольше moreих. thanНо theyправда do.в Butтом, theчто truthони isне theyхотят don’tчтобы wantучителя theirтоже teachersучились. toЭто beсильно tooпомогает muchв better.изучении Itесли helpsобщаться tremendouslyс toчеловеком learnкоторый fromнадавно someoneкасался whoэтой wasтемы. inСкорей yourвсего shoesони notпомнят tooподводные longкамни ago.и They’llразочарования moreкоторые likelyони rememberвстречали theранее, pitfallsпоэтому andони frustrationsсмогут theyпомочь encounteredвам earlyизбежать on,этого. soНо they’llкогда beраспределение ableприходит toв helpэкстремум, youнет avoidсреднего them.класса. ButЕсть whenнесколько theчеловек distributionкоторые skewsмогут towardsобучить theслушателей. extreme,В thereдобавок isне noпомня middleстарых class.ошибок, Thereэксперты areиспользуют fewerсложную peopleтерминологию. whoНовые canлюди optimallyв teachтеме newмогут learners.чувствовать Inпугающее addition to not remembering old mistakes, experts tend to use overly complicated terminology. New folks may feel intimidated by this and despair.отчаяние.

TURNINGПерелом THEв TIDE OF PRODUCTIONпроизводстве

TheНедостаток lackпроизводственной ofработы, productionкоторый workобсуждался mentionedвыше aboveсущественно contributesспособствует substantiallyэтому toразрыву. thisДругие divide.языки Many other languages, likeтипа C++, haveимеет strongстрогих academicакадемические followings.последователей. ButНо sinceпосле soиспользования manyего companiesкомпаниями useв производстве, он не столкнулся с проблемой передачи знаний, которые имеет Haskell. Компании использующие C++ inне production,имеют itвыбора, doesкроме notкак faceобучать theлюдей knowledgeязыку. distributionМножество problemэтих людей застряли в языке достаточно, чтобы обучить следующее поколение. Это создает более плавную кривую обучения.

Хорошие же новости для Haskell does.заключаются Companiesв usingтом, C++что haveесть noмножество choiceулучшенных butинструментов toза trainнесколько peopleпоследних toлет. useЭто theпривнесло language.возрождение Manyв ofязык. theseМножество peopleкомпаний stickначали withиспользовать theего languageв longпроизводстве. enoughПроходят toбольше trainвстреч, theбольше nextлюдей generation.пишут Thisбиблиотеки, createsдля aбольшинства moreкритических normalзадач. lookingЕсли knowledgeэто distributionпродолжится, curve.Haskell надеемся достигнет переломного момента где распространение становится уже нормальным.

Ключевая информация

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

TheНа good news forвстрече Haskell iseXchange there2016, haveДон beenСтюарт major tooling improvements in the last few years. This has brought about a renaissance for the language. More companies are starting to use it in production. More meetups are happening; more people are writing libraries for the most crucial tasks. If this trend continues, Haskell will hopefully reach a tipping point where the distribution becomes more normal.

THE KEY INSIGHT

If you are someone who is interested in learning Haskell, or who has tried learning Haskell in the past, there is one key thing to know. While the abstract mathematics is cool, understanding it is mostly unnecessary. Monads are essential. But category theory is overkill for most day-to-day problems you’ll solve. The dozens of language extensions might seem intimidating, but you can pick them up one-by-one as you go.из

At Haskell eXchange 2016, Don Stewart from Standard Chartered gave a talk about the company’s use of Haskell. He explained they rarely use anything outside of vanilla Haskell constructs*. They just don’t need to. Anything you can do with, say, lenses, you can accomplish without them.

Haskell is different from most other programming languages. It constrains you in ways those languages do not. But the constraints are not nearly as binding as they seem. You can’t use for loops. So use recursion. You can’t re-assign variables. So create new names for expressions. You just have take it one step at a time.

MOVING ON

Now that you know Haskell isn't really that scary, you should move on to part 2 of this series. You'll learn all about the very process of learning and a few tricks for more rapid improvement.

If you want, you can also jump right into some coding by looking at our Beginner's Checklist! It will help you get started with Haskell and point you towards some useful tools!

NOTE

*At least with respect to their normal Haskell code. Some of their code is in a proprietary language of theirs called Mu, which is built on Haskell but obviously different.