Skip to content

Commit

Permalink
Merge pull request #39 from cassioegc/bruno
Browse files Browse the repository at this point in the history
implementações
  • Loading branch information
bruno-meneses committed Jun 26, 2018
2 parents 5ee7950 + 194697f commit 50cb80a
Show file tree
Hide file tree
Showing 17 changed files with 1,508 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Build artifacts
dist/
*.hi
*.o

# Operating system rubbish
.DS_Store
Thumbs.db
22 changes: 22 additions & 0 deletions paradigma-funcional/batterseapower-ansi-terminal-57294e4/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2008, Maximilian Bolingbroke
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of Maximilian Bolingbroke nor the names of other contributors may be used to
endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
h1. ANSI Terminal

For all information on this package, please consult the "homepage":http://batterseapower.github.com/ansi-terminal
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /usr/bin/env runhaskell

> import Distribution.Simple
> main = defaultMain
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
-- | Provides ANSI terminal support for Windows and ANSI terminal software running on a Unix-like operating system.
--
-- The ANSI escape codes are described at <http://en.wikipedia.org/wiki/ANSI_escape_code> and provide a rich range of
-- functionality for terminal control, which includes:
--
-- * Colored text output, with control over both foreground and background colors
--
-- * Hiding or showing the cursor
--
-- * Moving the cursor around
--
-- * Clearing parts of the screen
--
-- The most frequently used parts of this ANSI command set are exposed with a platform independent interface by
-- this module. Every function exported comes in three flavours:
--
-- * Vanilla: has an @IO ()@ type and doesn't take a @Handle@. This just outputs the ANSI command directly on
-- to the terminal corresponding to stdout. Commands issued like this should work as you expect on both Windows
-- and Unix.
--
-- * Chocolate: has an @IO ()@ type but takes a @Handle@. This outputs the ANSI command on the terminal corresponding
-- to the supplied handle. Commands issued like this should also work as your expect on both Windows and Unix.
--
-- * Strawberry: has a @String@ type and just consists of an escape code which can be added to any other bit of text
-- before being output. This version of the API is often convenient to use, but due to fundamental limitations in
-- Windows ANSI terminal support will only work on Unix. On Windows these codes will always be the empty string,
-- so it is possible to use them portably for e.g. coloring console output on the understanding that you will only
-- see colors if you are running on a Unix-like operating system.
#if defined(WINDOWS)
module System.Console.ANSI (
module System.Console.ANSI.Windows
) where

import System.Console.ANSI.Windows

#elif defined(UNIX)

module System.Console.ANSI (
module System.Console.ANSI.Unix
) where

import System.Console.ANSI.Unix

#else

#error Unsupported platform for the ansi-terminal package

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
module System.Console.ANSI.Common where

import Data.Ix

-- | ANSI colors: come in various intensities, which are controlled by 'ColorIntensity'
data Color = Black
| Red
| Green
| Yellow
| Blue
| Magenta
| Cyan
| White
deriving (Eq, Ord, Bounded, Enum, Show, Read, Ix)

-- | ANSI colors come in two intensities
data ColorIntensity = Dull
| Vivid
deriving (Eq, Ord, Bounded, Enum, Show, Read, Ix)

-- | ANSI colors can be set on two different layers
data ConsoleLayer = Foreground
| Background
deriving (Eq, Ord, Bounded, Enum, Show, Read, Ix)

-- | ANSI blink speeds: values other than 'NoBlink' are not widely supported
data BlinkSpeed = SlowBlink -- ^ Less than 150 blinks per minute
| RapidBlink -- ^ More than 150 blinks per minute
| NoBlink
deriving (Eq, Ord, Bounded, Enum, Show, Read, Ix)

-- | ANSI text underlining
data Underlining = SingleUnderline
| DoubleUnderline -- ^ Not widely supported
| NoUnderline
deriving (Eq, Ord, Bounded ,Enum, Show, Read, Ix)

-- | ANSI general console intensity: usually treated as setting the font style (e.g. 'BoldIntensity' causes text to be bold)
data ConsoleIntensity = BoldIntensity
| FaintIntensity -- ^ Not widely supported: sometimes treated as concealing text
| NormalIntensity
deriving (Eq, Ord, Bounded, Enum, Show, Read, Ix)

-- | ANSI Select Graphic Rendition command
data SGR = Reset
| SetConsoleIntensity ConsoleIntensity
| SetItalicized Bool -- ^ Not widely supported: sometimes treated as swapping foreground and background
| SetUnderlining Underlining
| SetBlinkSpeed BlinkSpeed
| SetVisible Bool -- ^ Not widely supported
| SetSwapForegroundBackground Bool
| SetColor ConsoleLayer ColorIntensity Color
deriving (Eq, Ord, Show, Read)
Loading

0 comments on commit 50cb80a

Please sign in to comment.