G
G
giner2011-06-03 16:35:31
Haskell
giner, 2011-06-03 16:35:31

Haskell syntax in Xmonad context?

Greetings, friends Khabravchane!
I have been using Xmonad for a long time, but I can only make configs with clippings from examples. Step aside and everything stops working. Learning Haskell solely for the sake of using it in Xmonad is not justified, and I would not want to change Xmonad to something else either.
Can someone briefly explain the basics of Haskell syntax in relation to configuring Xmonad? If it doesn’t work out briefly, then you can also have an article on Habr.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
L
laughedelic, 2011-11-29
@laughedelic

Maybe this one: How will reading Haskell help Pythonists? Although I recommend reading the beginning of Learn you a Haskell for a great good is better - in the beginning, the syntax is explained. There is a translation .

B
bagyr, 2011-11-30
@bagyr

In general, the main thing in the config: As the correct open source, go to the source: xmonad.org/xmonad-docs/xmonad/src/XMonad-Config.html We are looking for XConfig: xmonad.org/xmonad-docs/xmonad/XMonad-Core.html #t :XConfig We see that this is data (you can read about it in any Haskell book) and all constructors, it is written about the exclamation point, for example, here . More specific questions can be in irc or on the archeforum, where people are sitting right up to the developers.
main = do
xmonad $ defaultConfig {}

defaultConfig = XConfig {}

Y
YourChief, 2011-06-04
@YourChief

Haskell is simple, learn it better and programming will open up to you from a new side. functional languages ​​are much prettier than imperative ones

J
JagaJaga, 2013-11-22
@JagaJaga

xmonad uses mostly simple and basic haskell stuff. A couple of evenings of studying this language, and you will understand everything.

M
Mikhail Potanin, 2013-12-12
@potan

Haskell is similar to standard mathematical notation. A lot can be understood just by remembering school matan lessons :-).
Functions are defined as a set of records:
argument_pattern name | condition = compute value for this sample.
All names of normal functions and other values ​​are written with a small letter or punctuation marks not starting with ':'. Constructors are written with a capital letter or with ':'.
: - list constructor. x:y:[] is the same as [x,y].
All list elements must be of the same type.
In samples, you can "call" constructors, but not functions. A small letter name in the pattern generates a new value to be associated with that name. That is, the pattern (x:y) will match a non-empty list, with the head of the list going into "variable" x and the rest of the list going into y.
In my opinion this should be enough.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question