Compiles!
This commit is contained in:
		
							parent
							
								
									efe41a0d3f
								
							
						
					
					
						commit
						1ef64aafc2
					
				
					 2 changed files with 8 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -21,7 +21,6 @@ to generate this file without the comments in this block.
 | 
			
		|||
  , "maybe"
 | 
			
		||||
  , "prelude"
 | 
			
		||||
  , "strings"
 | 
			
		||||
  , "tuples"
 | 
			
		||||
  ]
 | 
			
		||||
, packages = ./packages.dhall
 | 
			
		||||
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
module Main where
 | 
			
		||||
 | 
			
		||||
import Parser (Parser, parse)
 | 
			
		||||
import Parser (Parser(..))
 | 
			
		||||
import DomainParser (domain, label, ldh_str, sub_eof, subdomain)
 | 
			
		||||
 | 
			
		||||
import Prelude (Unit, discard, show, ($), (<>))
 | 
			
		||||
| 
						 | 
				
			
			@ -8,8 +8,9 @@ import Prelude (Unit, discard, show, ($), (<>))
 | 
			
		|||
import Effect (Effect)
 | 
			
		||||
import Effect.Console (log)
 | 
			
		||||
 | 
			
		||||
import Data.Maybe (Maybe(..))
 | 
			
		||||
import Data.Tuple (Tuple(..))
 | 
			
		||||
import Data.Either (Either(..))
 | 
			
		||||
--import Data.Maybe (Maybe(..))
 | 
			
		||||
--import Data.Tuple (Tuple(..))
 | 
			
		||||
 | 
			
		||||
import Data.String.CodeUnits (fromCharArray)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -39,12 +40,11 @@ import Data.String.CodeUnits (fromCharArray)
 | 
			
		|||
--     log $ toprint <> ", rest: " <> str
 | 
			
		||||
 | 
			
		||||
logtest :: forall e v. String -> Parser e v -> String -> (v -> String) -> Effect Unit
 | 
			
		||||
logtest fname (Parse p) str r = do
 | 
			
		||||
logtest fname (Parser p) str r = do
 | 
			
		||||
  log $ "(" <> fname <> ") parsing '" <> str <> "': "
 | 
			
		||||
    <> case p str of
 | 
			
		||||
      Left  { pos: pos, input: input, error: error  } -> "failed: " <> error
 | 
			
		||||
      Right { pos: pos, input: input, result: value } -> show (r x) <> " " <> show y
 | 
			
		||||
      Nothing -> "failed"
 | 
			
		||||
    <> case p { string: str, position: 0 } of
 | 
			
		||||
      Left  { position, error: _ } -> "failed at position " <> show position
 | 
			
		||||
      Right { suffix, result } -> show (r result) <> " '" <> suffix.string <> "'"
 | 
			
		||||
 | 
			
		||||
id :: forall a. a -> a
 | 
			
		||||
id a = a
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue