-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new flexSelect primitive as a generalization of flexGroup
- Loading branch information
1 parent
9acf517
commit cc781eb
Showing
4 changed files
with
71 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
hello true | ||
first | ||
hello false | ||
second | ||
hello whatever | ||
first | ||
hello whatever | ||
second |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module DodoFlexSelect where | ||
|
||
import Prelude | ||
|
||
import Dodo (Doc, break, flexAlt, flexSelect, fourSpaces, indent, plainText, print, text, words) | ||
import Effect (Effect) | ||
import Effect.Class.Console as Console | ||
|
||
test1 :: forall a. Doc a | ||
test1 = words | ||
[ text "hello" | ||
, indent $ flexSelect | ||
(flexAlt (text "true") (text "false")) | ||
(break <> text "first") | ||
(break <> text "second") | ||
] | ||
|
||
test2 :: forall a. Doc a | ||
test2 = words | ||
[ text "hello" | ||
, indent $ flexSelect | ||
(text "whatever") | ||
(break <> text "first") | ||
(break <> text "second") | ||
] | ||
|
||
main :: Effect Unit | ||
main = do | ||
Console.log $ print plainText fourSpaces test1 | ||
Console.log $ print plainText (fourSpaces { pageWidth = 1 }) test1 | ||
Console.log $ print plainText fourSpaces test2 | ||
Console.log $ print plainText (fourSpaces { pageWidth = 1 }) test2 |