Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

A small Python URL bruteforce

Name: Anonymous 2013-07-31 15:46

Hello /prog/, I need help with, well, programming.

I want to bruteforce URLs of the form sys.AAA.org/XXXX/BBB in python and sort the results by success or failure (determined by the returned text). AAA is a given website and BBB a given address.

XXXX is a 1 to 4 characters word using lowercase letters and numbers that I need to bruteforce.

Any tips or example on how to make a very simple bruteforce code in Python, I'm very new to this ?

Name: Anonymous 2013-07-31 15:53

1 - Generate the URLs. Assuming they are in the 7-bit ASCII range (all the important ones), there are only 270,549,120 different possibilities.
2 - Connect to each one, note the status code each time.
3 - Get banned every few minutes because you look like a DDoS attack to the IPS and firewall.
4 - Go ask /g/ to just h4xXx0r the site for you instead.

Name: Anonymous 2013-07-31 17:05

>>2
DON'T HELP HIM!

Name: Anonymous 2013-07-31 17:13

python
bruteforce

Name: Anonymous 2013-07-31 17:48

>>4
Maybe he doesn't want to burden their server.

Name: Anonymous 2013-07-31 18:11

>>3
It's not like I did anything but discourage him.

Name: Anonymous 2013-07-31 19:35

$ cat > x.py
import string
a = string.digits + string.letters
b = length(a)
for x in range(b**4):
    s = ''.join([a[(x / (b ** i)) % b] for i in range(4)]).reverse()
    url = 'www.AAA.com/%s/BBB' % s
    print('if curl "%s" > /dev/null; then echo %s; fi' % (url,url))

python x.py | bash

Name: OP 2013-08-01 10:55

Ok it's done. Thanks for your "help". The results are not surprising, the only legit hidden boards I found so far are /j/ and /test/.

Bruteforce started
Charset : 'abcdefghijklmnopqrstuvwxyz0123456789'
Maxlength : 3
http://sys.4chan.org/b/admin.php?admin=logout
http://sys.4chan.org/e/admin.php?admin=logout
http://sys.4chan.org/p/admin.php?admin=logout
http://sys.4chan.org/s/admin.php?admin=logout
http://sys.4chan.org/x/admin.php?admin=logout
http://sys.4chan.org/v/admin.php?admin=logout
http://sys.4chan.org/w/admin.php?admin=logout
http://sys.4chan.org/n/admin.php?admin=logout
http://sys.4chan.org/a/admin.php?admin=logout
http://sys.4chan.org/u/admin.php?admin=logout
http://sys.4chan.org/y/admin.php?admin=logout
http://sys.4chan.org/r/admin.php?admin=logout
http://sys.4chan.org/q/admin.php?admin=logout
http://sys.4chan.org/an/admin.php?admin=logout
http://sys.4chan.org/c/admin.php?admin=logout
http://sys.4chan.org/d/admin.php?admin=logout
http://sys.4chan.org/h/admin.php?admin=logout
http://sys.4chan.org/f/admin.php?admin=logout
http://sys.4chan.org/i/admin.php?admin=logout
http://sys.4chan.org/j/admin.php?admin=logout
http://sys.4chan.org/o/admin.php?admin=logout
http://sys.4chan.org/m/admin.php?admin=logout
http://sys.4chan.org/g/admin.php?admin=logout
http://sys.4chan.org/k/admin.php?admin=logout
http://sys.4chan.org/hc/admin.php?admin=logout
http://sys.4chan.org/hm/admin.php?admin=logout
http://sys.4chan.org/jp/admin.php?admin=logout
http://sys.4chan.org/ic/admin.php?admin=logout
http://sys.4chan.org/mu/admin.php?admin=logout
http://sys.4chan.org/po/admin.php?admin=logout
http://sys.4chan.org/sp/admin.php?admin=logout
http://sys.4chan.org/tg/admin.php?admin=logout
http://sys.4chan.org/tv/admin.php?admin=logout
http://sys.4chan.org/vp/admin.php?admin=logout
http://sys.4chan.org/vr/admin.php?admin=logout
http://sys.4chan.org/wg/admin.php?admin=logout
http://sys.4chan.org/vg/admin.php?admin=logout
http://sys.4chan.org/adv/admin.php?admin=logout
http://sys.4chan.org/asp/admin.php?admin=logout
http://sys.4chan.org/cgl/admin.php?admin=logout
http://sys.4chan.org/diy/admin.php?admin=logout
http://sys.4chan.org/gif/admin.php?admin=logout
http://sys.4chan.org/int/admin.php?admin=logout
http://sys.4chan.org/lit/admin.php?admin=logout
http://sys.4chan.org/mlp/admin.php?admin=logout
http://sys.4chan.org/out/admin.php?admin=logout
http://sys.4chan.org/pol/admin.php?admin=logout
http://sys.4chan.org/r9k/admin.php?admin=logout
http://sys.4chan.org/sci/admin.php?admin=logout
http://sys.4chan.org/soc/admin.php?admin=logout
http://sys.4chan.org/s4s/admin.php?admin=logout
http://sys.4chan.org/toy/admin.php?admin=logout
http://sys.4chan.org/trv/admin.php?admin=logout
http://sys.4chan.org/wsg/admin.php?admin=logout

Name: Anonymous 2013-08-01 12:02

>>7
Why b**4?

Name: Anonymous 2013-08-01 12:08

>>9
Never mind. I was too busying thinking about the less than awesome sex that 8'm gonna get from cudder's mom in a few hours.

Name: Anonymous 2013-08-01 12:40

https://sys.4chan.org/test/

"A username and password are being requested by https://sys.4chan.org. The site says: "Team 4chan""

Name: Anonymous 2013-08-01 13:05

>>11
No shit sherlock ?
That's for devs. Same for team.4chan.org, you'll need a password.
I was jusy checking to try and find other hidden boards

Name: Anonymous 2013-08-01 18:10

For series generation, you should have written an regular strings generator. This is a machine, which takes in a regular expression and puts out regular strings, which matches the regular expression.

I wrote it in a arrow style (instead of monadic), so we could generate infinite terms due to laziness.

Example usage
testHTTP = do
    s <- newStdGen
    return $ generateRegulars s "http://sys.AAA.org/[a-z0-9];{1,4}/BBBB"



{-# LANGUAGE RankNTypes,Arrows,BangPatterns #-}
module RegGen where

import Data.Monoid
import Control.Monad
import Control.Applicative
import Text.Parsec hiding ((<|>), many, State)
import Text.Parsec.String
import Text.Parsec.Prim hiding ((<|>),many, State)
import Text.Parsec.Combinator
import System.Random
import Control.Category
import Control.Arrow
import Prelude hiding ((.), id)
import Debug.Trace
-- | main api
--

testHTTP = do
    s <- newStdGen
    return $ generateRegulars s "http://sys.AAA.org/[a-z0-9];{1,4}/BBB"

data RegExpD = Character Char
        | Range [(RegExpD, RegExpD)] (Maybe RegExpD)
        | Star
        | StarPlus
        | One 
        | From Int     
        | Till Int
        | FromTill (Int,Int) 
        | Group RegExp (Maybe RegExpD)
    deriving Show
type Seed = StdGen
newtype RegExp = RegExp {
    unRegExp :: [RegExpD]
    }

newtype RandomArrow a b = RandomArrow {
        runRandomArrow :: Seed -> a -> (b,Seed)
    }   

instance Category RandomArrow where
    id = RandomArrow (\s a -> (a, s))
    (.) (RandomArrow f) (RandomArrow g) = RandomArrow (\s a -> let (b, s') = g s a
                                   in f s' b)
instance Arrow RandomArrow where
    arr f = RandomArrow (\s a -> (f a, s))
    first (RandomArrow f) = RandomArrow (\s (a,b) ->
                let (c, s') = f s a
                  in ((c,b), s')
            )
    second (RandomArrow f) = RandomArrow (\s (a,b) ->
                let (c, s') = f s b
                in ((a,c),s'))
instance ArrowChoice RandomArrow where
    left (RandomArrow f) = RandomArrow $ \s a -> case a of
                            Left a -> let (b, s') = f s a   
                                  in (Left b, s')
                            Right b -> (Right b, s)


state :: (a -> Seed -> (b, Seed)) -> RandomArrow a b
state f = RandomArrow (\s a -> f a s) 

instance Show RegExp where
    show (RegExp xs) = showRegExpD =<< xs
-- |  Generate string, which match the regular expression
--
--

generateRegulars :: Seed -> String -> [String]
generateRegulars xs s = do
    case parseRegularExpression s of
        Left e -> error (show e)
        Right a -> fst $ runRandomArrow (foreverA generate) xs a
--
foreverA f = RandomArrow $ \s a ->    let (b,s') = runRandomArrow f s a
                      (xs, s'') = runRandomArrow (foreverA f) s' a
                      in (b : xs,s'')


generate :: RandomArrow RegExp String
generate = proc (RegExp xs) -> do
        ys <- id -<  xs
        flatMapList genOne -< ys  

flatMapList :: Show b => Monoid b => RandomArrow a b -> RandomArrow [a] b 
flatMapList f = proc xs -> do
            case xs of
              [] -> returnA -< mempty
              (x:xs) ->  do 
                p <- flatMapList f -< xs
                n <- f -< x 
                returnA -<  mappend n p

genOne :: RandomArrow RegExpD String  
genOne  = proc x -> do
    case x of
      Character x -> arr (\x -> [x]) -< x
      Range xs Nothing -> do
            p <- choose -< xs
            range -< p 
      Range xs (Just a) -> do
             b <- toNum -< a
             repeatRandom rangeOne -< (xs,b)
      Group r Nothing -> do generate -< r 
      Group r (Just a) ->  do
        b <- toNum -< a
        repeatRandom  generate -< (r,b) 
    where rangeOne = proc xs -> do 
            p <- choose -< xs
            range -< p
     
     
toNum :: RandomArrow RegExpD Int
toNum = proc x -> do
        case x of
          Star -> arr abs <<< state randomR -< (1,50)  
          StarPlus -> arr ((+1).abs) <<< state randomR  -< (1,50)
          From x -> state randomR -< (x,50)
          Till x  -> state randomR -< (0, x)
          FromTill x -> state randomR -< x
            
repeatRandom :: RandomArrow a String -> RandomArrow (a,Int) String
repeatRandom  f = proc (x,b) -> do
            case b of
               0 -> returnA -< []
               n -> do 
                rest <- repeatRandom f -< (x, n - 1)
                p <- f -< x     
                returnA -<  (p ++ rest)

choose :: RandomArrow [a] a
choose = proc xs -> do
        p <- state (\xs -> randomR (0, length xs - 1)) -< xs
        returnA -< xs !! p
               

range :: RandomArrow (RegExpD,RegExpD) String
range = proc x -> do
      case x of    
       (Character a, Character b) -> arr (\x -> [x]) <<< state randomR -< (a,b)
     
       



{--   
instance Show RegExpD where
    show = showRegExpD
--}
-- | Parse a regular expression

parseRegularExpression :: String -> Either ParseError RegExp
parseRegularExpression s = parse parseReg "" s


parseReg :: Parser RegExp
parseReg =  RegExp <$> many1 parseRegExpD

parseRegExpD :: Parser RegExpD
parseRegExpD = try parseGroup <|> try parseRange  <|> parseChar 

parseInt' :: Parser Int
parseInt' = read <$> (many1 $ oneOf "1234567890")

-- a-zA-Z0-9
parseChar :: Parser RegExpD
parseChar = try parseEscapedChar <|> parseNormalChar

parseEscapedChar :: Parser RegExpD
parseEscapedChar = char '\\' *> (Character <$> oneOf "[]-(){}")

parseNormalChar :: Parser RegExpD
parseNormalChar = Character <$> oneOf "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM NOPQRSTUVWXYZ!\"#$%&'*+,./:;<=>?@\\^_`|~ \t"

parseRange :: Parser RegExpD
parseRange = char '[' *> step
    where step = 
        do
           x <- (many twice)
           char ']'
           m <- optionMaybe parseModifier
           case x of    
            xs -> return $ Range (xs) m
twice :: Parser (RegExpD, RegExpD)
twice = (,) <$> parseChar <*> (char '-' *> parseChar)
groupTwo :: [a] -> [(a,a)]   
groupTwo (x:y:xs) = (x,y) : groupTwo xs
groupTwo (x:ys) = []
groupTwo _ = []

parseModifier :: Parser RegExpD
parseModifier = try (char '*' *> pure Star) <|> try (char '+'*> pure StarPlus) <|> try (char '?' *> pure One) <|>  try to <|>  try from <|> fromto
    where fromto =  char '{' *>
        (FromTill <$> ((,) <$> (parseInt' <* char ',')  <*> (parseInt'))) <* char '}'
          from = char '{' *> (From <$> (parseInt' <* char ',')) <* char '}'
          to = char '{' *> char ',' *> (char ',' *> (Till <$> parseInt')) <* char '}'
           
           

parseGroup :: Parser RegExpD
parseGroup  = Group <$> (char '(' *> (parseReg <* char ')')) <*> optionMaybe parseModifier

-- | Show a regular expression in a normal form
showRegExpD :: RegExpD -> String
showRegExpD (Character c) = [c]
showRegExpD (Range xs n) = "[" <> foldr (\(a,b) z -> show a <> "-" <> show b <> z) [] xs <> "]" <> showMaybe n (showRegExpD)
showRegExpD (Star) = "*"
showRegExpD (StarPlus) = "+"
showRegExpD (From n) = "{" <> show n <> ",}"
showRegExpD (Till n) = "{," <> show n <> "}"
showRegExpD (FromTill (p,q)) = "{" <> show p <> "," <> show q <> "}"
showRegExpD (Group bs p ) = "(" <> (show bs) <> ")" <> showMaybe p (showRegExpD)
showRegExpD (One) = "?"


-- | Helper
showMaybe ::  Maybe a -> (a -> String) -> String
showMaybe Nothing f = mempty
showMaybe (Just a) f = f a

Name: Anonymous 2013-08-01 18:18

>>13
- Like C++, Haskell is huge in size, enormously hard to learn, and takes decades to master (just Haskell's extensions list exceeds 70 entries http://hackage.haskell.org/packages/archive/hint/0.3.3.6/doc/html/Language-Haskell-Interpreter-Extension.html). Things like Monads, Functors, Monoids, Higher-Order Types and a myriad of morphisms are hard to understand, especially without mathematical background. Most programmers probably don't have the ability or will to learn Haskell. Learning Haskell's syntax, libraries, functional programming techniques won't bring you closer to understanding: the true path to understand Haskell lies through Monoid-Functor-Applicative-Arrow-Monad. And even if you mange to learn Haskell, programming it still hogs a lot of brain resources, which could have been put to something more useful than just showing off about how clever you can be. "Haskell for Kids" even proposes exposing children to Haskell from yearly age, meaning Haskell, similar to mathematics and natural language, will be much harder to grasp at older age. "Zygohistomorphic prepromorphism: Zygo implements semi-mutual recursion like a zygomorphism. Para gives you access to your result à la paramorphism.", "Haskell is not 'a little different,' and will not 'take a little time.' It is very different and you cannot simply pick it up" -- HaskellWiki
- Poor backward compatibility: haskellers "don't want to replicate Java, which is outright flawed in order to avoid even the most unlikely of broken code", meaning they don't care if new version of GHC will break your code. Haskell projects are struggling under the weight of "DLL hell": typical Haskell package consist of just a few lines of code, thus many other projects depend on dozens of different packages, either directly or indirectly. It's near-impossible to embark on a serious Haskell project without spending time fighting dependency version issues.
- Haskell is slow and leaks memory. GHC's inefficient stop-the-world GC does not scale. Despite being statically typed, Haskell can't deliver the bare metal speed, with typical Haskell code being 30x to 200x times slower than C/C++ (http://honza.ca/2012/10/haskell-strings http://www.mail-archive.com/haskell-cafe%40haskell.org/msg25645.html). A good understanding of evaluation order is very important for writing practical programs. People using Haskell often have no idea how evaluation affects the efficiency. It is no coincidence that Haskell programmers end up floundering around with space and time leaks that they do not understand. Functions take time to complete and debugging for time leaks is much more difficult than to debug for type errors. "The next Haskell will be strict." -- Simon Peyton-Jones
- Haskell's API lacks higher levels of abstraction, due to absence of variadic functions, optional arguments and keywords. Macros aren't possible either, due to overly complex syntax of Haskell, which impedes metaprogramming and complicates parsing for human and machine alike. API documentation is very lacking: if you want to use regexes, you start at Text.Regex.Posix, seeing that =~ and =~~ are the high level API, and the hyperlinks for those functions go to Text.Regex.Posix.Wrap, where the main functions are not actually documented at all, so you look at the type signatures, trying to understand them and they are rather intimidating (class RegexOptions regex compOpt execOpt => RegexMaker regex compOpt execOpt source | regex -> compOpt execOpt, compOpt -> regex execOpt, execOpt -> regex compOpt where). They are using multi-parameter type classes and functional dependencies. The signature really wont give you any clue to how to actually use this API, which is a science in itself. Haskell is a language where memoization is a PhD-level topic. Some people even employ C/C++ macros to work-around Haskell's complexity (http://lukepalmer.wordpress.com/2007/07/26/making-haskell-nicer-for-game-programming/)
- Haskell programming relies on mathematical modeling with type system (a version of mathematical Set Theory). If one does not use the type system for anything useful, it obviously will be nothing but a burden. Programs are limited by the expressiveness of the type system of the language - e.g. heterogeneous data structures aren't possible w/o reinventing explicit tagging. All that makes Haskell bad for prototyping or anything new, due to need of having design document with all types beforehand, which changes often during prototyping. Complex project are forced to reinvent dynamic typing. For instance, Grempa uses dynamic typing because the semantic action functions are put in an array indexing rule and production numbers (Ints) to functions, and they all have different types and so can not be put in an ordinary array expecting the same type for each element.
- The IDE options cannot be as good as those of dynamic programming languages, due to absence of run-time information and access to running program's state. Haskell's necrophilia forces you to work with "dead" code. Like other static languages, Haskell isn't well-known for its "reload on the fly" productivity. No eval or self-modifying code. Haskell code can't be changed without recompiling half of application and restarting the process. GHCI - is the best Haskell's interactivity can get, and still wont allow you to change types during runtime, while the single assignment semantics prevents redefinition of functions. As said Simon Peyton-Jones, "In the end, any program must manipulate state. A program that has no side effects whatsoever is a kind of black box. All you can tell is that the box gets hotter."
- Type system produced compile-time and link-time errors are distracting and make it harder to run and test your code, while type-checking isn't a substitute for testing, it is about correspondence to mathematical model, which has nothing to do with correctness - i.e. two numbers can be integers, but their quotient may still produce division by zero. Static-typing advocates say, "When your program type-checks, you'll often find that it just works", but this is simply not true for large, intricate programs: although type-checking may help you find model-related errors, it can't replace testing.
- Absence of dynamic scope, implicit open recursion, late binding, and duck typing severely limits Haskell, since there are things that can't be done easily without these features: you can't implement dynamic scope in general (and be type-safe) without converting your entire program to use tagged values. So in this respect, Haskell is inferior to dynamic typing languages.
- Syntax craziness: Haskell has a>>b>>c, do{a; b; c}, "do a; b; c", where `;` could be substituted by newlines, which is incredible confusing, especially when combined with currying and if/then/else blocks.
- Haskell makes it easy to write cryptic programs that no-one understands, not even yourself a few days later. Rich, baroque syntax, auto currying, lazy evaluation and a tradition defining an operator for every function - all help obfuscation a lot. As a general rule, Haskell syntax is incredibly impenetrable: who in their right mind thought up the operators named .&., <|> and >>=? Currying everywhere, besides making language slower, leads to spaghetti code and surprising Perl-style errors, where call with a missing or superfluous argument produces error in some unrelated part of the code.

Name: Anonymous 2013-08-01 18:21

>>14

Luckily I don't have problems understanding haskell. And I can memoize my expressions.

Thank you for your retarded and inaccurate copy pasta. Delicate flower. :0~~=8

Name: Anonymous 2013-08-01 18:29

>>15
Shalom, Hymie!

Name: Anonymous 2013-08-01 18:30

>>15
Laziness makes it difficult to reason about when computation happens, and it can result in serious space leaks. I’ve been writing Haskell for over a decade and using it as my main language at work for at least five years, and I’ve never learned to do efficient code beyond simple cases. Purity makes it painful to discover and propagate run-time configuration information, while in most languages it’s easy to read a configuration file at startup and store the result in a global variable, but in Haskell that requires dirty tricks. Haskell module system (if you can even call it that) is clearly inferior to Standard ML’s and OCaml’s module systems. Its compile-time meta-programming facility, Template Haskell, is occasionally useful, but it’s a poor substitute for a real, Lisp macro system. Haskell’s type system, even with recent extensions in that direction, won’t let you prove as much as Coq or Agda. Haskell changes quickly and sometimes unpredictably; Haskell code breaks and needs to be updated not only for major GHC version increments but often for minor versions as well. Finally, Haskell does suffer some social weaknesses by being weird and researchy. Because Haskell is so different from the languages that most people know, it presents steep learning curve.

Name: Anonymous 2013-08-01 18:31

>>15
Haskell sucks because programming is 99% about "side effects" than mathematical formulas.

Please note the use of quotes for 'side effects'. They are called 'side effects', although they are the most interesting part of programming. It's the part that things happen inside a computer that change the world.

Haskell makes it really difficult to write useful code (where useful means 'with side effects').

They may show you how to create 'infinite' number sequences and process them.

Cool. Ask them to make a Model-View-Controller application in Haskell, where the model is a tree of nodes. Trivial in imperative languages, hard as hell in Haskell: you have to use the Zipper monad, mix the useful code with visitation to the tree code, because the only way to modify tree node links in Haskell is via local parameters...

Name: Anonymous 2013-08-01 18:32

>>15
Haskell is very hard, but even after 3 years of pretty intensive use, I never really felt productive with haskell in the same way that I've felt in other languages. Anything I did in haskell required a lot of thinking up-front and tinkering in the REPL to make sure the types all agreed and it was rather time-consuming to assemble a selection of data types and functions that mapped adequately onto the problem I was trying to solve. More often than not, the result was something of an unsightly jumble that would take a long time to convert into nicer-looking code or to make an API less terrible to use.

Name: Anonymous 2013-08-01 18:32

>>15

And everybody else went and chased static. And they've been doing it like crazy. And they've, in my opinion, reached the theoretical bounds of what they can deliver, and it has FAILED. These static type systems, they're WRONG. Wrong in the sense that when you try to do something, and they say: No, category theory doesn't allow that, because it's not elegant... Hey man: who's wrong? The person who's trying to write the program, or the type system?

Name: Anonymous 2013-08-01 18:32

>>14
>decades to master any programming language
yeah no, fuck off gladwell

Name: Anonymous 2013-08-01 18:34

>>21
Haskell, OCaml and their ilk are part of a 45-year-old static-typing movement within academia to try to force people to model everything. Programmers hate that. These languages will never, ever enjoy any substantial commercial success, for the exact same reason the Semantic Web is a failure. You can't force people to provide metadata for everything they do. They'll hate you.

An important theoretical idea behind type systems is "soundness". Researchers love to go on about whether a type system is "sound" or not, and "unsound" type systems are considered bad. C++ and Java have "unsound" type systems. To date, the more "sound" a type system is, the more often it's wrong when you try to use it. This is half the reason that C++ and Java are so successful: they let you stop using the type system whenever it gets in your way. The other half of their success stems from the ability to create user-defined static types. The reason C++ and Java (particularly Java) have been so successful is that their type systems form a "let's not get any work done" playground for n00bs to spend time modeling things and telling themselves stories. You can't actually model everything; it's formally impossible and pragmatically a dead-end. But they try. And they tell their peers that you have to model everything or you're a Bad Citizen.

One very real technical problem with the forced-modeling approaches that static type systems are often "wrong". It may be hard to imagine, because by a certain definition they can't be "wrong": the code (or data) is programmatically checked to conform to whatever constraints are imposed by the type system. So the code or data always matches the type model. But the type system is "wrong" whenever it cannot match the intended computational model. Every time want to use multiple inheritance or mixins in Java's type system, Java is "wrong", because it can't do what you want. You have to take the most natural design and corrupt it to fit Java's view of the world.

Name: Anonymous 2013-08-01 18:35

>>21
I decided to stop torturing myself and part with Haskell. Why I did that?
1. I don't give a damn about its type system and Haskell was putting it in my throat.
2. I didn't learned anything new. Well beside bunch of tricks, and I wasn't looking for tricks. I expected new paradigm, novel idea or an elegant combination of existing ones but there was nothing of those to inspire me to continue wrestling with the static typing.

The best description of static typing came from Aatu Koskensilta: One of the reasons to prefer a powerful type system is precisely the ability to encode some such conditions and information in the types. The usefulness of a type system depends on which conditions are expressible in it, and with what amount of effort. In any case, if one does not use the type system for anything useful, it obviously will be nothing but a burden.

Learning to program in languages such as Haskell involves learning how to use its type system to do useful thing, just as one would learn to use macros etc. when learning Common Lisp or Scheme. Don't think of the type system as a straight-jacket, think of it as something to hack, a tool -- or just continue writing your code in a dynamically typed language if that's your thing.

And static typing is definitely not my thing. But if I decide to get in those waters someday I will look no further than Qi, it has the most powerful type system, it's optional and I could even hope that it'll be ASDF packaged.

It may interest you to know that most of my development time for that was spent typing: paging through the library, trying things out at the REPL, tweaking, debugging, iterating. It's a style I find much easier than staring at a blank screen and thinking very hard, and one for which I find forgiving languages like Perl and Lisp are much better than Haskell.

Farewell Haskell, you're joining the company of languages that didn't taught me much about programming nor changed the way I'm thinking. As Alan Perlis once said: "A language that doesn't affect the way you think about programming, is not worth knowing". The rest of the crew consists of pascal, basic, delphi, php, c#, ocaml, python and sql.

Name: Anonymous 2013-08-01 18:36

>>21
I can pinpoint the exact page in Real World Haskell where I became lost. I was reading along surprisingly well until page 156, upon introduction of newtype.

At that my point my smug grin became a panicked grimace. The next dozen pages were an insane downward spiral into the dark labyrinth of Haskell's type system. I had just barely kept data and class and friends straight in my mind. type I managed to ignore completely. newtype was the straw that broke the camel's back.

As a general rule, Haskell syntax is incredibly impenetrable. => vs. -> vs. <-? I have yet to reach the chapter dealing with >>=. The index tells me I can look forward to such wonders as >>? and ==> and <|>. Who in their right mind thought up the operator named .&.? The language looks like Japanese emoticons run amuck. If and when I reach the \(^.^)/ operator I'm calling it a day.

Maybe Lisp has spoiled me, but the prospect of memorizing a list of punctuation is wearisome. And the way you can switch between prefix and infix notation using parens and backticks makes my eyes cross. Add in syntactic whitespace and I don't know what to tell you.

Name: Anonymous 2013-08-01 18:37

>>18
Bullshit, everything is about algorithms, most of the time you are transforming data.

Name: Anonymous 2013-08-01 18:39

>>25
Bullshit, everything is about state, most of the time you are changing state.

Name: Anonymous 2013-08-01 18:40

>>25
Sort of like how your mom transforms to some 18 year old hooker when she has sex with the guy down the road from your trailer park?

Name: Anonymous 2013-08-01 18:40

>>25
Bullshit, everything is about lolies, most of the time you are shitting pro/g/.

Name: Anonymous 2013-08-01 18:42

>>25
Bullshit, everything is about readability, most of the time you are writing code.

Name: Anonymous 2013-08-01 18:42

>>24
I loved your post.

Name: Anonymous 2013-08-01 18:46

>>18

MVC is difficult in haskell, because it is not an abstraction which has any meaning in haskell. 

I am actually quite productive in haskell, as productive in a dynamic language. And most complex things are easier than in other languages. Concurrency is a breeze thanks to STM. This means no deadlocks anymore. A parser is a piece of cake. AST transformations are easier.

IO isn't even difficult. A monad can be a model of an imperative language. The IO monad is nothing more than a simulated C environment.

This is because of the join operation:


join :: m (m  a) ->(m a)


This means that any structure hidden in m can be joined with the structure in the underlying m.

|--------|
|   s_new|
----------  -- join -> [s_new]
|   s_old|
----------

I have a physics background, so maybe this helps. But I find haskell easy to understand. I also have done a lot of mathematics and I found that category theory is extremely simple , but also very abstract. It just matches the way I think, that makes it easy to express myself in it.

Name: Anonymous 2013-08-01 18:48

>>24
I was reading along surprisingly well until page 156, upon introduction of newtype.
This sounds like you just scanned over the first parts, didn't throughly understand them, and then got lost when the book started to go into detail. That's a common beginner's mistake when learning Haskell. type, data, class and newtype are trivial to understand.

Name: Anonymous 2013-08-01 18:50

>>17

You never heard of a profiler?

Don't change these.
Name: Email:
Entire Thread Thread List