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

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현