Meaning of a semicolon in lambda expressionWhat does “static” mean in C?Retrieving Property name from lambda expressionWhy would you use Expression<Func<T>> rather than Func<T>?Why are Python lambdas useful?Distinct() with lambda?What does “use strict” do in JavaScript, and what is the reasoning behind it?What does the star operator mean?Why does ++[[]][+[]]+[+[]] return the string “10”?How can a time function exist in functional programming?What is a lambda expression in C++11?

Formal mathematical definition of renormalization group flow

Variable doesn't parse as string

The Game of the Century - why didn't Byrne take the rook after he forked Fischer?

Is there a way to improve my grade after graduation?

Single flight multiple flight numbers?

Is there a booking app or site that lets you specify your gender for shared dormitories?

If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?

How do I know when and if a character requires a backstory?

When using the Proficiency Dice optional rule, how should they be used in determining a character's Spell Save DC?

What's "halachic" about "Esav hates Ya'akov"?

Is it okay to use different fingers every time while playing a song on keyboard? Is it considered a bad practice?

How easy is it to get a gun illegally in the United States?

what can you do with Format View

Why do rocket engines use nitrogen actuators to operate the fuel/oxidiser valves instead of electric servos?

Is a switch from R to Python worth it?

Why is the Vasa Museum in Stockholm so Popular?

How to design an effective polearm-bow hybrid?

Awk to get all my regular users in shadow

Is an "are" omitted in this sentence

Is there a way to say "double + any number" in German?

Why is it to say 'paucis post diebus'?

Write The Shortest Program To Check If A Binary Tree Is Balanced

How to win against ants

Would this winged human/angel be able to fly?



Meaning of a semicolon in lambda expression


What does “static” mean in C?Retrieving Property name from lambda expressionWhy would you use Expression<Func<T>> rather than Func<T>?Why are Python lambdas useful?Distinct() with lambda?What does “use strict” do in JavaScript, and what is the reasoning behind it?What does the star operator mean?Why does ++[[]][+[]]+[+[]] return the string “10”?How can a time function exist in functional programming?What is a lambda expression in C++11?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















Type:



data Command a = Command String (a -> IO a) 


Function:



iofunc_ :: String -> (a -> IO ()) -> Command a
iofunc_ s f = Command s (x -> do f x ; return x)


What does the semicolon do in the lambda expression (x -> do f x ; return x)?










share|improve this question





















  • 3





    It's part of the do-notation, not the lambda.

    – augustss
    Dec 25 '14 at 12:08

















3















Type:



data Command a = Command String (a -> IO a) 


Function:



iofunc_ :: String -> (a -> IO ()) -> Command a
iofunc_ s f = Command s (x -> do f x ; return x)


What does the semicolon do in the lambda expression (x -> do f x ; return x)?










share|improve this question





















  • 3





    It's part of the do-notation, not the lambda.

    – augustss
    Dec 25 '14 at 12:08













3












3








3


1






Type:



data Command a = Command String (a -> IO a) 


Function:



iofunc_ :: String -> (a -> IO ()) -> Command a
iofunc_ s f = Command s (x -> do f x ; return x)


What does the semicolon do in the lambda expression (x -> do f x ; return x)?










share|improve this question
















Type:



data Command a = Command String (a -> IO a) 


Function:



iofunc_ :: String -> (a -> IO ()) -> Command a
iofunc_ s f = Command s (x -> do f x ; return x)


What does the semicolon do in the lambda expression (x -> do f x ; return x)?







haskell lambda syntax






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 5:21









dfeuer

35.2k3 gold badges52 silver badges137 bronze badges




35.2k3 gold badges52 silver badges137 bronze badges










asked Dec 25 '14 at 11:54









StankoStanko

1,4402 gold badges11 silver badges37 bronze badges




1,4402 gold badges11 silver badges37 bronze badges










  • 3





    It's part of the do-notation, not the lambda.

    – augustss
    Dec 25 '14 at 12:08












  • 3





    It's part of the do-notation, not the lambda.

    – augustss
    Dec 25 '14 at 12:08







3




3





It's part of the do-notation, not the lambda.

– augustss
Dec 25 '14 at 12:08





It's part of the do-notation, not the lambda.

– augustss
Dec 25 '14 at 12:08












2 Answers
2






active

oldest

votes


















8














They just separate the two expression f x and return x in do notation. In fact these all are equivalent in your case:



iofunc_ s f = Command s (x -> do f x ; return x)

iofunc_ s f = Command s (x -> do f x ; return x)

iofunc_ s f = Command s (x -> do f x
return x)

iofunc_ s f = Command s (x -> f x >> return x)





share|improve this answer




















  • 1





    When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.

    – kqr
    Dec 25 '14 at 14:27












  • @kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example with let.

    – Sibi
    Dec 25 '14 at 15:50












  • @Sibi Thank you.

    – Stanko
    Dec 25 '14 at 16:29


















1














Semicolon anywhere is equivalent to a change of line indented to the same level as the previous valid expression.



I saw it by going through how indentation works (https://en.wikibooks.org/wiki/Haskell/Indentation).






share|improve this answer



























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f27646966%2fmeaning-of-a-semicolon-in-lambda-expression%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    8














    They just separate the two expression f x and return x in do notation. In fact these all are equivalent in your case:



    iofunc_ s f = Command s (x -> do f x ; return x)

    iofunc_ s f = Command s (x -> do f x ; return x)

    iofunc_ s f = Command s (x -> do f x
    return x)

    iofunc_ s f = Command s (x -> f x >> return x)





    share|improve this answer




















    • 1





      When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.

      – kqr
      Dec 25 '14 at 14:27












    • @kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example with let.

      – Sibi
      Dec 25 '14 at 15:50












    • @Sibi Thank you.

      – Stanko
      Dec 25 '14 at 16:29















    8














    They just separate the two expression f x and return x in do notation. In fact these all are equivalent in your case:



    iofunc_ s f = Command s (x -> do f x ; return x)

    iofunc_ s f = Command s (x -> do f x ; return x)

    iofunc_ s f = Command s (x -> do f x
    return x)

    iofunc_ s f = Command s (x -> f x >> return x)





    share|improve this answer




















    • 1





      When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.

      – kqr
      Dec 25 '14 at 14:27












    • @kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example with let.

      – Sibi
      Dec 25 '14 at 15:50












    • @Sibi Thank you.

      – Stanko
      Dec 25 '14 at 16:29













    8












    8








    8







    They just separate the two expression f x and return x in do notation. In fact these all are equivalent in your case:



    iofunc_ s f = Command s (x -> do f x ; return x)

    iofunc_ s f = Command s (x -> do f x ; return x)

    iofunc_ s f = Command s (x -> do f x
    return x)

    iofunc_ s f = Command s (x -> f x >> return x)





    share|improve this answer













    They just separate the two expression f x and return x in do notation. In fact these all are equivalent in your case:



    iofunc_ s f = Command s (x -> do f x ; return x)

    iofunc_ s f = Command s (x -> do f x ; return x)

    iofunc_ s f = Command s (x -> do f x
    return x)

    iofunc_ s f = Command s (x -> f x >> return x)






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Dec 25 '14 at 12:08









    SibiSibi

    31.2k9 gold badges65 silver badges129 bronze badges




    31.2k9 gold badges65 silver badges129 bronze badges










    • 1





      When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.

      – kqr
      Dec 25 '14 at 14:27












    • @kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example with let.

      – Sibi
      Dec 25 '14 at 15:50












    • @Sibi Thank you.

      – Stanko
      Dec 25 '14 at 16:29












    • 1





      When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.

      – kqr
      Dec 25 '14 at 14:27












    • @kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example with let.

      – Sibi
      Dec 25 '14 at 15:50












    • @Sibi Thank you.

      – Stanko
      Dec 25 '14 at 16:29







    1




    1





    When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.

    – kqr
    Dec 25 '14 at 14:27






    When can you omit the curly braces? I always thought they were mandatory if you made the semicolon explicit.

    – kqr
    Dec 25 '14 at 14:27














    @kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example with let.

    – Sibi
    Dec 25 '14 at 15:50






    @kqr Didn't read the Haskell report fully, but you can see that's what they have demonstrated in the example with let.

    – Sibi
    Dec 25 '14 at 15:50














    @Sibi Thank you.

    – Stanko
    Dec 25 '14 at 16:29





    @Sibi Thank you.

    – Stanko
    Dec 25 '14 at 16:29













    1














    Semicolon anywhere is equivalent to a change of line indented to the same level as the previous valid expression.



    I saw it by going through how indentation works (https://en.wikibooks.org/wiki/Haskell/Indentation).






    share|improve this answer





























      1














      Semicolon anywhere is equivalent to a change of line indented to the same level as the previous valid expression.



      I saw it by going through how indentation works (https://en.wikibooks.org/wiki/Haskell/Indentation).






      share|improve this answer



























        1












        1








        1







        Semicolon anywhere is equivalent to a change of line indented to the same level as the previous valid expression.



        I saw it by going through how indentation works (https://en.wikibooks.org/wiki/Haskell/Indentation).






        share|improve this answer













        Semicolon anywhere is equivalent to a change of line indented to the same level as the previous valid expression.



        I saw it by going through how indentation works (https://en.wikibooks.org/wiki/Haskell/Indentation).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 12 '17 at 9:49









        hhefestohhefesto

        1158 bronze badges




        1158 bronze badges






























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f27646966%2fmeaning-of-a-semicolon-in-lambda-expression%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript