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

Pages: 1-4041-

Why not?

Name: Anonymous 2011-10-06 13:28


$ ghci
GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Prelude> let yoba a b = if a < b then 123 else "abc"

<interactive>:1:29:
    No instance for (Num [Char])
      arising from the literal `123' at <interactive>:1:29-31
    Possible fix: add an instance declaration for (Num [Char])
    In the expression: if a < b then 123 else "abc"
    In the definition of `yoba':
        yoba a b = if a < b then 123 else "abc"
Prelude>

Name: Anonymous 2011-10-06 13:30

>>1
you left out the html tags
``faggot''

Name: Anonymous 2011-10-06 13:37

>>2
"<?haskell >" tags? does apache support haskell, like PHP?

Name: Anonymous 2011-10-06 13:38

haskell should be dynamically typed

Name: Anonymous 2011-10-06 13:39

>>4
dynamically typed haskell called "scheme"

Name: Anonymous 2011-10-06 13:41

<?PHP
if (OP == FAGGOT)
    echo "OP is a faggot";
else
    echo "OP is a faggot";

</java?>

Name: Anonymous 2011-10-06 13:49

>>5
Trading syntax for dynamic typing?  Nah.

Name: Anonymous 2011-10-06 14:02

>>7
Use Perl 6. It has plenty of syntax.

Name: Anonymous 2011-10-06 14:03

>>8
Trading lack of sigils for syntax?  Nah.

Name: Anonymous 2011-10-06 14:24

yoba

Name: Anonymous 2011-10-06 14:50

If you really need to do that (which I'm sure you don't), use Either.

yoba :: (Ord a) => a -> a -> Either Int String
yoba a b | a < b     = Left 123
         | otherwise = Right "abc"

f :: (Ord a) => a -> a -> String
f a b = case yoba a b of
            Left _  -> "something"
            Right _ -> "something else"

Name: Anonymous 2011-10-06 17:05

>>9
You mean lack of sigil variance?

Name: Anonymous 2011-10-06 17:13

>>4
Static typing is one of Haskell's most important features, if it was dynamically typed it wouldn't be Haskell at all. That's like saying that Lisp should have C-like syntax.

Name: Anonymous 2011-10-06 17:27

In Haskell, numbers aren't strings. Have fun with your Javascript.

Name: Anonymous 2011-10-06 19:15

>>13
if it was dynamically typed it wouldn't be Haskell at all
Exactly.  It would be something better.

Name: Anonymous 2011-10-07 0:04

>>11
Looks ugly.

Name: Anonymous 2011-10-07 0:11

Static typing.

Name: Anonymous 2011-10-07 0:22

So how can I integrate Haskell with Apache and MySQL?

Name: Anonymous 2011-10-07 0:24

Name: HAXUS THE SAGE 2011-10-07 0:28

Not /prog/ related. GTFO!

Name: HAXUS THE SAGE 2011-10-07 0:28

Not /prog/ related. GTFO!

Name: Anonymous 2011-10-07 0:32

>>16
yoba a b = if a < b then Left 123 else Right "abc"

Better?

Name: Anonymous 2011-10-07 1:48

>>22
better Left else Right
No.

Name: Anonymous 2011-10-07 1:53

>>22
It doesn't work

$ ghci
GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Prelude> let yoba a b = if a < b then Left 123 else Right "abc"
Prelude> (yoba 3 4)
Left 123
Prelude> (yoba 3 4)/2

<interactive>:1:0:
    No instance for (Fractional (Either t [Char]))
      arising from a use of `/' at <interactive>:1:0-11
    Possible fix:
      add an instance declaration for (Fractional (Either t [Char]))
    In the expression: (yoba 3 4) / 2
    In the definition of `it': it = (yoba 3 4) / 2
Prelude>

Name: Anonymous 2011-10-07 1:55

>>24
Breaking news! Haskell can't divide 123 by 2!

Name: Anonymous 2011-10-07 2:05

(defun yoba (a b) (if (< a b) '(123 "abc") '("abc" 123)))
(* 2 (car (yoba 1 2)))

246

let yoba a b = if a < b then [123, "abc"] else ["abc", 123]
2*(head (yoba 1 2))

<interactive>:1:30:
    No instance for (Num [Char])
      arising from the literal `123' at <interactive>:1:30-32
    Possible fix: add an instance declaration for (Num [Char])
    In the expression: 123
    In the expression: if a < b then [123, "abc"] else ["abc", 123]
    In the definition of `yoba':
        yoba a b = if a < b then [123, "abc"] else ["abc", 123]

Name: Anonymous 2011-10-07 2:16

>>15
( ≖‿≖)

Name: Anonymous 2011-10-07 2:22

>>25
>>24
integral division -> div
floating point    -> (/)

(yoba 3 4) `div` 2 :: Works

come on >>24, you could use :t (/), to see the type before you post.

Name: Anonymous 2011-10-07 2:29

guys when experiment with a new language don't treat it as an old one you know, there is a reason why prolog is prolog and not perl. because they represent different mindsets

what would you thinks if some chinese man came and tell you: "hey english is shit. why if i tell ``treetree" doesn't mean forest as in chinese, man you idiom sucks"

ofter under-skilled people make incorrect judgments and the worse is that they think other persons should know their opinion
socrates would roll in his grave

Name: Anonymous 2011-10-07 3:02

>>29
what would you thinks if some chinese man came and tell you: "hey english is shit. why if i tell ``treetree" doesn't mean forest as in chinese, man you idiom sucks"
In fact, my native language is highly synthetic and english sounds too static and formal. There is even no way to mutate words to my liking! I cant have a cute version of word, neither I have a crude one. English should be more dynamic.

Name: Anonymous 2011-10-07 3:04

>>28
What?! I dont care about types, I just want to have work done in a most straightforward way.

Name: Anonymous 2011-10-07 3:09

>>31
There are no straightforward ways with Haskell.

Name: Anonymous 2011-10-07 3:11

>>31
Then you cannot be a quality programmer with such attitude. You will always remain omega level.

Name: Anonymous 2011-10-07 3:17

>>33
<interactive>:1:0: Not in scope: data constructor `Quality'

Name: Anonymous 2011-10-07 3:36

>>24

the point of learning a different language is to learn how to
do things in a different way. you're too caught up in the
javascript-ruby-java-c-python mindset.

you think that in a new language you should first learn; how to
define a function, how to call it with different arguments, how
to save/edit values, etc... so that you can go on using it like
you were using every other language: half assed, ignoring half
of it's features while abusing the other half to fit some kind
of retarded model of how you think things should be done....

probably you already have your "one true language" (which you
use exclusively, although you still like to rag on it) ... so i
suggest you go back to working with your language in which
there is a difference between a pointer to the function "foo"
and the value of calling foo with no arguements "foo()" and
leave us alone.

Name: Anonymous 2011-10-07 3:42

>>35
the point of learning a different language is to..
..write code faster and easier, wasting fewer brain resources.

There is no other reason to prefer air transportation to sea one, or Internet to airmail. Haskell compared to Lisp is like sea mail compared to Internet.

Name: Anonymous 2011-10-07 8:04

>>36
then you should use just lisp then

god, why do you feel entitled to let everyone else know your opinions.

Name: Anonymous 2011-10-07 9:02

>>37
"Why not?"

Name: Anonymous 2011-10-07 9:04

>>37
Because typenazi Haskell is shit and so is parentheLisp.

Name: Anonymous 2011-10-07 10:08

>>38
contribute nothing to the thread? random babling should be on another forum

OK i got you like lisp, does that have something to do with this question?

Name: Anonymous 2011-10-07 11:03

>>24
Because if you could do that, you could also do yoba 4 3 `div` 2, which is obviously wrong. You obviously have no clue how Haskell works, so just go back to Javascript like >>14 said.

Name: Anonymous 2011-10-07 11:23

>>41
"Why not?"

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